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 @@ -1273,3 +1273,19 @@ SELECT
12731273 SHORT_DESC::VARCHAR2 (255 ) AS DESCRIPTION
12741274FROM PG_SETTINGS;
12751275
1276+ -- Create DBA_CONS_COLUMNS view for Oracle compatibility
1277+ CREATE OR REPLACE VIEW sys .dba_cons_columns AS
1278+ SELECT
1279+ SYS .ORA_CASE_TRANS (pg_get_userbyid(n .oid )::varchar2 (128 )) AS owner,
1280+ SYS .ORA_CASE_TRANS (c .conname ::varchar2 (128 )) AS constraint_name,
1281+ SYS .ORA_CASE_TRANS (cl .relname ::varchar2 (128 )) AS table_name,
1282+ SYS .ORA_CASE_TRANS (a .attname ::varchar2 (128 )) AS column_name,
1283+ (row_number() OVER (PARTITION BY c .oid ORDER BY a .attnum ))::int AS position,
1284+ CASE WHEN a .attnotnull THEN ' Y' ELSE ' N' END AS nullable
1285+ FROM pg_constraint c
1286+ JOIN pg_class cl ON c .conrelid = cl .oid
1287+ JOIN pg_namespace n ON cl .relnamespace = n .oid
1288+ JOIN pg_attribute a ON a .attrelid = cl .oid AND a .attnum = ANY(c .conkey )
1289+ WHERE cl .relkind = ' r'
1290+ AND a .attisdropped = false
1291+ AND n .nspname NOT IN (' pg_catalog' , ' information_schema' );
You can’t perform that action at this time.
0 commit comments