diff --git a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql index 76ce519b30..c195f79555 100644 --- a/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql +++ b/contrib/babelfishpg_tsql/sql/babelfishpg_tsql.sql @@ -1123,7 +1123,7 @@ FROM pg_catalog.pg_class t1 JOIN sys.pg_namespace_ext t2 ON t1.relnamespace = t2.oid JOIN pg_catalog.pg_roles t3 ON t1.relowner = t3.oid LEFT OUTER JOIN sys.babelfish_namespace_ext ext on t2.nspname = ext.nspname - JOIN information_schema_tsql.columns t4 ON (t1.relname = t4."TABLE_NAME" COLLATE sys.database_default AND ext.orig_name = t4."TABLE_SCHEMA" ) + JOIN information_schema_tsql.columns t4 ON (cast(t1.relname as sys.nvarchar(128)) = t4."TABLE_NAME" AND ext.orig_name = t4."TABLE_SCHEMA" ) JOIN pg_constraint t5 ON t1.oid = t5.conrelid , generate_series(1,16) seq -- SQL server has max 16 columns per primary key WHERE t5.contype = 'p' diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--3.5.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--3.5.0.sql index 7b1076d53a..f264604221 100644 --- a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--3.5.0.sql +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--3.5.0.sql @@ -38,6 +38,27 @@ LANGUAGE plpgsql; * final behaviour. */ +CREATE OR REPLACE VIEW sys.sp_pkeys_view AS +SELECT +CAST(t4."TABLE_CATALOG" AS sys.sysname) AS TABLE_QUALIFIER, +CAST(t4."TABLE_SCHEMA" AS sys.sysname) AS TABLE_OWNER, +CAST(t1.relname AS sys.sysname) AS TABLE_NAME, +CAST(t4."COLUMN_NAME" AS sys.sysname) AS COLUMN_NAME, +CAST(seq AS smallint) AS KEY_SEQ, +CAST(t5.conname AS sys.sysname) AS PK_NAME +FROM pg_catalog.pg_class t1 + JOIN sys.pg_namespace_ext t2 ON t1.relnamespace = t2.oid + JOIN pg_catalog.pg_roles t3 ON t1.relowner = t3.oid + LEFT OUTER JOIN sys.babelfish_namespace_ext ext on t2.nspname = ext.nspname + JOIN information_schema_tsql.columns t4 ON (cast(t1.relname as sys.nvarchar(128)) = t4."TABLE_NAME" AND ext.orig_name = t4."TABLE_SCHEMA" ) + JOIN pg_constraint t5 ON t1.oid = t5.conrelid + , generate_series(1,16) seq -- SQL server has max 16 columns per primary key +WHERE t5.contype = 'p' + AND CAST(t4."ORDINAL_POSITION" AS smallint) = ANY (t5.conkey) + AND CAST(t4."ORDINAL_POSITION" AS smallint) = t5.conkey[seq] + AND ext.dbid = sys.db_id(); + + -- Drops the temporary procedure used by the upgrade script. -- Please have this be one of the last statements executed in this upgrade script. DROP PROCEDURE sys.babelfish_drop_deprecated_object(varchar, varchar, varchar); diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule index e0668f01f4..153138d282 100644 --- a/test/JDBC/parallel_query_jdbc_schedule +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -60,10 +60,6 @@ ignore#!#babel_datetime-vu-verify ignore#!#babel_datetime ignore#!#BABEL-2812-vu-verify -# output difference: JIRA-4542 -ignore#!#sys-sp_pkeys-dep-vu-verify -ignore#!#BABEL-SP_PKEYS - # Test failures caused by babel_extra_join_test_cases_northwind failure ignore#!#babelfish_sysdatabases-vu-prepare ignore#!#babelfish_sysdatabases-vu-verify