특정 스키마의 특정 테이블에 대해서 FK가 존재하는지 확인하는 쿼리를 보고있는데
에러가 나네요;;
SELECT tc.table_name AS child_table,
kcu.column_name AS child_colum,
ccu.table_name AS foreign_table,
ccu.column_name AS foreign_column
FROM information_schema.table_constraints tc
JOIN information_schema.key_column_usage kcu ON tc.constraint_name::text = kcu.constraint_name::text
JOIN information_schema.constraint_column_usage ccu ON ccu.constarint_name::text = tc.constraint_name::text
WHERE tc.constraint_type = 'FOREIGN KEY' and tc.table_schema = 'testsch' and tc.table_name = 'testtable'
위 쿼리를 이용하여 testsch 스키마에 있는 testtable에 존재하는 FK를 보고싶은데
ERROR: column ccu.constarint_name does not exist
LINE 7: ...information_schema.constraint_column_usage ccu ON ccu.consta...
===>두번쨰 JOIN문의 ccu.constarint_name부분입니다.
^
HINT: Perhaps you meant to reference the column "ccu.constraint_name".
********** Error **********
ERROR: column ccu.constarint_name does not exist
SQL state: 42703
Hint: Perhaps you meant to reference the column "ccu.constraint_name".
Character: 349
이런 에러가 납니다.. 뭐가 문제인가요??
|