junhkang/spectra

PostgreSQL PK 리스트를 가져오는 백엔드 API 생성

Aperta

#36 aperta il 19 giu 2024

 (2 commenti) (0 reazioni) (1 assegnatario)Java (4 fork)auto 404
backendenhancementgood first issuepriority: high

Metriche repository

Star
 (6 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

상세 내용

  1. 쿼리 작성: PostgreSQL에서 PK 리스트를 가져오는 쿼리 작성
  2. 페이징 처리: 페이지 번호를 받아서 결과를 페이징 처리할 수 있도록 구현합니다.
  3. 쿼리 실행 시간 포함: API의 리턴 값에 쿼리 실행 시간을 포함시킵니다.

작업 내용

  • PostgreSQL 데이터베이스에서 PK 리스트를 가져오는 쿼리 작성
    • 쿼리:
      SELECT 
        tc.table_schema, 
        tc.table_name, 
        kc.column_name, 
        tc.constraint_name
      FROM 
        information_schema.table_constraints tc
      JOIN 
        information_schema.key_column_usage kc 
      ON 
        tc.constraint_name = kc.constraint_name
      WHERE 
        tc.constraint_type = 'PRIMARY KEY';
      
  • 페이지 번호를 받아 페이징 처리 구현
  • API 리턴 값에 쿼리 실행 시간 포함
  • 추후 스키마를 선택해야 할 경우 WHERE tc.table_schema='public' 추가 고려

Guida contributor