2014-02-25 3 views
0

첫 번째 열이 citext로 정의 된 예제 테이블을 만들었습니다.postgreSQL에서 citext 형식의 열을 식별하는 방법

CREATE TABLE users (
nick CITEXT PRIMARY KEY, 
pass TEXT NOT NULL 
); 

내가 열 이름과 데이터 유형을 얻기 위해 다음과 같은 쿼리를 실행하려고하면, 닉 열의 데이터 형식으로 반환됩니다 사용자 정의.

select column_name, data_type from information_schema.columns 
where table_name = 'users'; 

    column_name | data_type 
1 nick   | USER-DEFINED 
2 pass   | text 

닉크 열이 citext 인 경우 postgreSQL의 모든 테이블을 쿼리하여 알 수있는 방법이 있습니까?

답변

0

당신은 data_type 대신 열 udt_name를 사용해야합니다 :

create type compfoo AS (f1 int, f2 text); 

create table compfoo_table (cp compfoo); 

select udt_name from information_schema.columns where column_name = 'cp'; 

-- drop table compfoo_table; 
-- drop type compfoo; 

Documentation

+0

감사합니다. 그게 바로 제가 찾던 것입니다. –

관련 문제