File tree Expand file tree Collapse file tree
contrib/ivorysql_ora/src/sysview Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1213,4 +1213,29 @@ CREATE OR REPLACE VIEW SYS.USER_CONS_COLUMNS AS
12131213 AND C .RELNAMESPACE != ' INFORMATION_SCHEMA' ::REGNAMESPACE::OID
12141214ORDER BY
12151215 TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME
1216- ;
1216+ ;
1217+
1218+ /* USER_CONS_COLUMNS */
1219+ CREATE OR REPLACE VIEW SYS .USER_CONS_COLUMNS AS
1220+ SELECT
1221+ c .relname AS TABLE_NAME,
1222+ a .attname AS COLUMN_NAME,
1223+ a .attnum AS COLUMN_ID,
1224+ t .typname AS DATA_TYPE,
1225+ a .atttypmod AS DATA_LENGTH,
1226+ a .attnotnull AS NULLABLE,
1227+ CASE WHEN i .indisprimary THEN ' P' ELSE NULL END AS CONSTRAINT_TYPE,
1228+ d .description AS COMMENTS
1229+ FROM
1230+ pg_class c
1231+ JOIN pg_attribute a ON c .oid = a .attrelid
1232+ JOIN pg_type t ON a .atttypid = t .oid
1233+ LEFT JOIN pg_index i ON c .oid = i .indrelid AND a .attnum = i .indkey [0 ]
1234+ LEFT JOIN pg_description d ON c .oid = d .objoid AND a .attnum = d .objsubid
1235+ WHERE
1236+ c .relowner = (SELECT usesysid FROM pg_user WHERE usename = current_user )
1237+ AND c .relkind IN (' r' , ' v' )
1238+ AND a .attnum > 0
1239+ AND NOT a .attisdropped
1240+ ORDER BY
1241+ c .relname , a .attnum ;
You can’t perform that action at this time.
0 commit comments