diff --git a/.github/scripts/clone_engine_repo.conf b/.github/scripts/clone_engine_repo.conf index f0b7d2f5eb..024af54df9 100644 --- a/.github/scripts/clone_engine_repo.conf +++ b/.github/scripts/clone_engine_repo.conf @@ -1 +1 @@ -DEFAULT_BRANCH=BABEL_3_4_STABLE__PG_15_5 +DEFAULT_BRANCH=BABEL_4_X_DEV__PG_16_X diff --git a/contrib/babelfishpg_tsql/sql/sys_views.sql b/contrib/babelfishpg_tsql/sql/sys_views.sql index 7af60d3e26..261033561e 100644 --- a/contrib/babelfishpg_tsql/sql/sys_views.sql +++ b/contrib/babelfishpg_tsql/sql/sys_views.sql @@ -1504,6 +1504,7 @@ and nis.type = (case p.prokind where (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) and has_schema_privilege(s.oid, 'USAGE') and has_function_privilege(p.oid, 'EXECUTE') +and p.proname != 'pltsql_call_handler' union all -- details of user defined procedures 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 deleted file mode 100644 index e90710163a..0000000000 --- a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--3.5.0.sql +++ /dev/null @@ -1,178 +0,0 @@ --- complain if script is sourced in psql, rather than via ALTER EXTENSION -\echo Use "ALTER EXTENSION ""babelfishpg_tsql"" UPDATE TO '3.5.0'" to load this file. \quit - --- add 'sys' to search path for the convenience -SELECT set_config('search_path', 'sys, '||current_setting('search_path'), false); - --- Drops an object if it does not have any dependent objects. --- Is a temporary procedure for use by the upgrade script. Will be dropped at the end of the upgrade. --- Please have this be one of the first statements executed in this upgrade script. -CREATE OR REPLACE PROCEDURE babelfish_drop_deprecated_object(object_type varchar, schema_name varchar, object_name varchar) AS -$$ -DECLARE - error_msg text; - query1 text; - query2 text; -BEGIN - - query1 := pg_catalog.format('alter extension babelfishpg_tsql drop %s %s.%s', object_type, schema_name, object_name); - query2 := pg_catalog.format('drop %s %s.%s', object_type, schema_name, object_name); - - execute query1; - execute query2; -EXCEPTION - when object_not_in_prerequisite_state then --if 'alter extension' statement fails - GET STACKED DIAGNOSTICS error_msg = MESSAGE_TEXT; - raise warning '%', error_msg; - when dependent_objects_still_exist then --if 'drop view' statement fails - GET STACKED DIAGNOSTICS error_msg = MESSAGE_TEXT; - raise warning '%', error_msg; -end -$$ -LANGUAGE plpgsql; - --- Please add your SQLs here -/* - * Note: These SQL statements may get executed multiple times specially when some features get backpatched. - * So make sure that any SQL statement (DDL/DML) being added here can be executed multiple times without affecting - * 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(); - --- Rename functions for dependencies -DO $$ -DECLARE - exception_message text; -BEGIN - -- Rename parsename for dependencies - ALTER FUNCTION sys.parsename(sys.VARCHAR, INT) RENAME TO parsename_deprecated_in_3_5_0; - -EXCEPTION WHEN OTHERS THEN - GET STACKED DIAGNOSTICS - exception_message = MESSAGE_TEXT; - RAISE WARNING '%', exception_message; -END; -$$; - -DO $$ -DECLARE - exception_message text; -BEGIN - -- Rename sp_set_session_context for dependencies - ALTER PROCEDURE sys.sp_set_session_context(sys.SYSNAME, sys.SQL_VARIANT, sys.BIT) RENAME TO sp_set_session_context_deprecated_in_3_5_0; - -EXCEPTION WHEN OTHERS THEN - GET STACKED DIAGNOSTICS - exception_message = MESSAGE_TEXT; - RAISE WARNING '%', exception_message; -END; -$$; - -DO $$ -DECLARE - exception_message text; -BEGIN - -- Rename session_context for dependencies - ALTER FUNCTION sys.session_context(sys.SYSNAME) RENAME TO session_context_deprecated_in_3_5_0; - -EXCEPTION WHEN OTHERS THEN - GET STACKED DIAGNOSTICS - exception_message = MESSAGE_TEXT; - RAISE WARNING '%', exception_message; -END; -$$; - -CREATE OR REPLACE FUNCTION sys.parsename(object_name sys.NVARCHAR, object_piece int) -RETURNS sys.NVARCHAR(128) -AS 'babelfishpg_tsql', 'parsename' -LANGUAGE C IMMUTABLE STRICT; - -CREATE OR REPLACE PROCEDURE sys.sp_set_session_context ("@key" sys.NVARCHAR(128), - "@value" sys.SQL_VARIANT, "@read_only" sys.bit = 0) -AS 'babelfishpg_tsql', 'sp_set_session_context' -LANGUAGE C; -GRANT EXECUTE ON PROCEDURE sys.sp_set_session_context TO PUBLIC; - -CREATE OR REPLACE FUNCTION sys.session_context ("@key" sys.NVARCHAR(128)) -RETURNS sys.SQL_VARIANT -AS 'babelfishpg_tsql', 'session_context' -LANGUAGE C; -GRANT EXECUTE ON FUNCTION sys.session_context TO PUBLIC; - --- Update existing logins to remove createrole privilege -CREATE OR REPLACE PROCEDURE sys.bbf_remove_createrole_from_logins() -LANGUAGE C -AS 'babelfishpg_tsql', 'remove_createrole_from_logins'; -CALL sys.bbf_remove_createrole_from_logins(); - --- === DROP deprecated functions (if exists) -DO $$ -DECLARE - exception_message text; -BEGIN - -- === DROP parsename_deprecated_in_3_5_0 - CALL sys.babelfish_drop_deprecated_object('function', 'sys', 'parsename_deprecated_in_3_5_0'); - -EXCEPTION WHEN OTHERS THEN - GET STACKED DIAGNOSTICS - exception_message = MESSAGE_TEXT; - RAISE WARNING '%', exception_message; -END; -$$; - -DO $$ -DECLARE - exception_message text; -BEGIN - -- === DROP sp_set_session_context_deprecated_in_3_5_0 - CALL sys.babelfish_drop_deprecated_object('procedure', 'sys', 'sp_set_session_context_deprecated_in_3_5_0'); - -EXCEPTION WHEN OTHERS THEN - GET STACKED DIAGNOSTICS - exception_message = MESSAGE_TEXT; - RAISE WARNING '%', exception_message; -END; -$$; - -DO $$ -DECLARE - exception_message text; -BEGIN - -- === DROP session_context_deprecated_in_3_5_0 - CALL sys.babelfish_drop_deprecated_object('function', 'sys', 'session_context_deprecated_in_3_5_0'); - -EXCEPTION WHEN OTHERS THEN - GET STACKED DIAGNOSTICS - exception_message = MESSAGE_TEXT; - RAISE WARNING '%', exception_message; -END; -$$; - --- 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); - --- After upgrade, always run analyze for all babelfish catalogs. -CALL sys.analyze_babelfish_catalogs(); - --- Reset search_path to not affect any subsequent scripts -SELECT set_config('search_path', trim(leading 'sys, ' from current_setting('search_path')), false); diff --git a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--4.0.0.sql b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--4.0.0.sql index f3255823c3..7eae510ab4 100644 --- a/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--4.0.0.sql +++ b/contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--3.4.0--4.0.0.sql @@ -270,6 +270,412 @@ EXCEPTION WHEN OTHERS THEN END; $$; +create or replace view sys.all_objects as +select + name collate sys.database_default + , cast (object_id as integer) + , cast ( principal_id as integer) + , cast (schema_id as integer) + , cast (parent_object_id as integer) + , type collate sys.database_default + , cast (type_desc as sys.nvarchar(60)) + , cast (create_date as sys.datetime) + , cast (modify_date as sys.datetime) + , is_ms_shipped + , cast (is_published as sys.bit) + , cast (is_schema_published as sys.bit) +from +( +-- Currently for pg_class, pg_proc UNIONs, we separated user defined objects and system objects because the +-- optimiser will be able to make a better estimation of number of rows(in case the query contains a filter on +-- is_ms_shipped column) and in turn chooses a better query plan. + +-- details of system tables +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'U'::char(2) as type + , 'USER_TABLE' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.table_types_internal tt on t.oid = tt.typrelid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'U' +where t.relpersistence in ('p', 'u', 't') +and t.relkind = 'r' +and (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and tt.typrelid is null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +union all +-- details of user defined tables +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'U'::char(2) as type + , 'USER_TABLE' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.table_types_internal tt on t.oid = tt.typrelid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'U' +where t.relpersistence in ('p', 'u', 't') +and t.relkind = 'r' +and s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and tt.typrelid is null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') + +union all +-- details of system views +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'V'::char(2) as type + , 'VIEW'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'V' +where t.relkind = 'v' +and (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') +union all +-- Details of user defined views +select + t.relname::sys.sysname as name + , t.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'V'::char(2) as type + , 'VIEW'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class t inner join pg_namespace s on s.oid = t.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = t.relname and nis.schemaid = s.oid and nis.type = 'V' +where t.relkind = 'v' +and s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and has_schema_privilege(s.oid, 'USAGE') +and has_table_privilege(t.oid, 'SELECT,INSERT,UPDATE,DELETE,TRUNCATE,TRIGGER') +union all +-- details of user defined and system foreign key constraints +select + c.conname::sys.sysname as name + , c.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , c.conrelid as parent_object_id + , 'F'::char(2) as type + , 'FOREIGN_KEY_CONSTRAINT' + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_constraint c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'F' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'f' +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of user defined and system primary key constraints +select + c.conname::sys.sysname as name + , c.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , c.conrelid as parent_object_id + , 'PK'::char(2) as type + , 'PRIMARY_KEY_CONSTRAINT' as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_constraint c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'PK' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'p' +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of system defined procedures +select + p.proname::sys.sysname as name + , p.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , cast (case when tr.tgrelid is not null + then tr.tgrelid + else 0 end as int) + as parent_object_id + , case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end as type + , case p.prokind + when 'p' then 'SQL_STORED_PROCEDURE'::varchar(60) + when 'a' then 'AGGREGATE_FUNCTION'::varchar(60) + else + case + when t.typname = 'trigger' + then 'SQL_TRIGGER'::varchar(60) + when p.proretset then + case + when t.typtype = 'c' + then 'SQL_TABLE_VALUED_FUNCTION'::varchar(60) + else 'SQL_INLINE_TABLE_VALUED_FUNCTION'::varchar(60) + end + else 'SQL_SCALAR_FUNCTION'::varchar(60) + end + end as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 1::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_proc p +inner join pg_namespace s on s.oid = p.pronamespace +inner join pg_catalog.pg_type t on t.oid = p.prorettype +left join pg_trigger tr on tr.tgfoid = p.oid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.proname and nis.schemaid = s.oid +and nis.type = (case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end) +where (s.nspname = 'sys' or (nis.name is not null and ext.nspname is not null)) +and has_schema_privilege(s.oid, 'USAGE') +and has_function_privilege(p.oid, 'EXECUTE') +and p.proname != 'pltsql_call_handler' + +union all +-- details of user defined procedures +select + p.proname::sys.sysname as name + , p.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , cast (case when tr.tgrelid is not null + then tr.tgrelid + else 0 end as int) + as parent_object_id + , case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end as type + , case p.prokind + when 'p' then 'SQL_STORED_PROCEDURE'::varchar(60) + when 'a' then 'AGGREGATE_FUNCTION'::varchar(60) + else + case + when t.typname = 'trigger' + then 'SQL_TRIGGER'::varchar(60) + when p.proretset then + case + when t.typtype = 'c' + then 'SQL_TABLE_VALUED_FUNCTION'::varchar(60) + else 'SQL_INLINE_TABLE_VALUED_FUNCTION'::varchar(60) + end + else 'SQL_SCALAR_FUNCTION'::varchar(60) + end + end as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , 0::sys.bit as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_proc p +inner join pg_namespace s on s.oid = p.pronamespace +inner join pg_catalog.pg_type t on t.oid = p.prorettype +left join pg_trigger tr on tr.tgfoid = p.oid +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.proname and nis.schemaid = s.oid +and nis.type = (case p.prokind + when 'p' then 'P'::char(2) + when 'a' then 'AF'::char(2) + else + case + when t.typname = 'trigger' + then 'TR'::char(2) + when p.proretset then + case + when t.typtype = 'c' + then 'TF'::char(2) + else 'IF'::char(2) + end + else 'FN'::char(2) + end + end) +where s.nspname <> 'sys' and nis.name is null +and ext.nspname is not null +and has_schema_privilege(s.oid, 'USAGE') +and has_function_privilege(p.oid, 'EXECUTE') + +union all +-- details of all default constraints +select + ('DF_' || o.relname || '_' || d.oid)::sys.sysname as name + , d.oid as object_id + , null::int as principal_id + , o.relnamespace as schema_id + , d.adrelid as parent_object_id + , 'D'::char(2) as type + , 'DEFAULT_CONSTRAINT'::sys.nvarchar(60) AS type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_catalog.pg_attrdef d +inner join pg_attribute a on a.attrelid = d.adrelid and d.adnum = a.attnum +inner join pg_class o on d.adrelid = o.oid +inner join pg_namespace s on s.oid = o.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = ('DF_' || o.relname || '_' || d.oid) and nis.schemaid = s.oid and nis.type = 'D' +where a.atthasdef = 't' and a.attgenerated = '' +and (s.nspname = 'sys' or ext.nspname is not null) +and has_schema_privilege(s.oid, 'USAGE') +and has_column_privilege(a.attrelid, a.attname, 'SELECT,INSERT,UPDATE,REFERENCES') +union all +-- details of all check constraints +select + c.conname::sys.sysname + , c.oid::integer as object_id + , NULL::integer as principal_id + , s.oid as schema_id + , c.conrelid::integer as parent_object_id + , 'C'::char(2) as type + , 'CHECK_CONSTRAINT'::sys.nvarchar(60) as type_desc + , null::sys.datetime as create_date + , null::sys.datetime as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_catalog.pg_constraint as c +inner join pg_namespace s on s.oid = c.connamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = c.conname and nis.schemaid = s.oid and nis.type = 'C' +where has_schema_privilege(s.oid, 'USAGE') +and c.contype = 'c' and c.conrelid != 0 +and (s.nspname = 'sys' or ext.nspname is not null) +union all +-- details of user defined and system defined sequence objects +select + p.relname::sys.sysname as name + , p.oid as object_id + , null::integer as principal_id + , s.oid as schema_id + , 0 as parent_object_id + , 'SO'::char(2) as type + , 'SEQUENCE_OBJECT'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (s.nspname = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from pg_class p +inner join pg_namespace s on s.oid = p.relnamespace +left join sys.babelfish_namespace_ext ext on (s.nspname = ext.nspname and ext.dbid = sys.db_id()) +left join sys.shipped_objects_not_in_sys nis on nis.name = p.relname and nis.schemaid = s.oid and nis.type = 'SO' +where p.relkind = 'S' +and (s.nspname = 'sys' or ext.nspname is not null) +and has_schema_privilege(s.oid, 'USAGE') +union all +-- details of user defined table types +select + ('TT_' || tt.name || '_' || tt.type_table_object_id)::sys.sysname as name + , tt.type_table_object_id as object_id + , tt.principal_id as principal_id + , tt.schema_id as schema_id + , 0 as parent_object_id + , 'TT'::char(2) as type + , 'TABLE_TYPE'::varchar(60) as type_desc + , null::timestamp as create_date + , null::timestamp as modify_date + , CAST (case when (tt.schema_id::regnamespace::text = 'sys' or nis.name is not null) then 1 + else 0 end as sys.bit ) as is_ms_shipped + , 0 as is_published + , 0 as is_schema_published +from sys.table_types tt +left join sys.shipped_objects_not_in_sys nis on nis.name = ('TT_' || tt.name || '_' || tt.type_table_object_id)::name and nis.schemaid = tt.schema_id and nis.type = 'TT' +) ot; +GRANT SELECT ON sys.all_objects TO PUBLIC; + -- 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/dev-tools.sh b/dev-tools.sh index dd23a63940..95aa7ad40f 100755 --- a/dev-tools.sh +++ b/dev-tools.sh @@ -173,7 +173,7 @@ init_db() { init_pghint() { cd $1 if [ ! -d "./pg_hint_plan" ]; then - git clone --depth 1 --branch REL15_1_5_1 https://github.com/ossc-db/pg_hint_plan.git + git clone --depth 1 --branch REL16_1_6_0 https://github.com/ossc-db/pg_hint_plan.git fi cd pg_hint_plan export PATH=$2/postgres/bin:$PATH diff --git a/test/JDBC/expected/BABEL-3613-vu-verify.out b/test/JDBC/expected/BABEL-3613-vu-verify.out index b5bdb89060..2bd175f29c 100644 --- a/test/JDBC/expected/BABEL-3613-vu-verify.out +++ b/test/JDBC/expected/BABEL-3613-vu-verify.out @@ -58,3 +58,26 @@ GO int#!#varchar#!#int#!#nvarchar ~~END~~ + +-- BABEL-4662 +select count(*) from sys.all_objects where name = 'pltsql_call_handler'; +go +~~START~~ +int +0 +~~END~~ + +select count(*) from sys.procedures where name = 'pltsql_call_handler'; +go +~~START~~ +int +0 +~~END~~ + +select count(*) from sys.system_objects where name = 'pltsql_call_handler'; +go +~~START~~ +int +0 +~~END~~ + diff --git a/test/JDBC/input/BABEL-3613-vu-verify.sql b/test/JDBC/input/BABEL-3613-vu-verify.sql index 5c9de65ec5..da1a4a1fd7 100644 --- a/test/JDBC/input/BABEL-3613-vu-verify.sql +++ b/test/JDBC/input/BABEL-3613-vu-verify.sql @@ -27,3 +27,11 @@ where object_id in (select object_id from sys.all_objects group by object_id having count(object_id) > 1) order by object_id, name; GO + +-- BABEL-4662 +select count(*) from sys.all_objects where name = 'pltsql_call_handler'; +go +select count(*) from sys.procedures where name = 'pltsql_call_handler'; +go +select count(*) from sys.system_objects where name = 'pltsql_call_handler'; +go diff --git a/test/JDBC/parallel_query_jdbc_schedule b/test/JDBC/parallel_query_jdbc_schedule index 8b62f9c884..bd9af30fc0 100644 --- a/test/JDBC/parallel_query_jdbc_schedule +++ b/test/JDBC/parallel_query_jdbc_schedule @@ -15,6 +15,11 @@ ignore#!#sp_who-vu-prepare ignore#!#sp_who-vu-verify ignore#!#sp_who-vu-cleanup +# Test failures in BABEL_4_X_DEV +ignore#!#BABEL-328-vu-verify +ignore#!#pgr_select_distinct +ignore#!#TestSQLQueries + # Group 1: BABEL-4481 ignore#!#Test-sp_addrolemember-vu-prepare ignore#!#Test-sp_addrolemember-vu-verify diff --git a/test/python/expected/sql_validation_framework/expected_drop.out b/test/python/expected/sql_validation_framework/expected_drop.out index aa3b3d21f4..11c23df00e 100644 --- a/test/python/expected/sql_validation_framework/expected_drop.out +++ b/test/python/expected/sql_validation_framework/expected_drop.out @@ -44,7 +44,6 @@ Unexpected drop found for procedure sys.babelfish_drop_deprecated_object in file Unexpected drop found for procedure sys.babelfish_drop_deprecated_object in file babelfishpg_tsql--3.1.0--3.2.0.sql Unexpected drop found for procedure sys.babelfish_drop_deprecated_object in file babelfishpg_tsql--3.2.0--3.3.0.sql Unexpected drop found for procedure sys.babelfish_drop_deprecated_object in file babelfishpg_tsql--3.3.0--3.4.0.sql -Unexpected drop found for procedure sys.babelfish_drop_deprecated_object in file babelfishpg_tsql--3.4.0--3.5.0.sql Unexpected drop found for procedure sys.babelfish_drop_deprecated_object in file babelfishpg_tsql--3.4.0--4.0.0.sql Unexpected drop found for procedure sys.babelfish_drop_deprecated_table in file babelfishpg_tsql--2.1.0--2.2.0.sql Unexpected drop found for procedure sys.babelfish_drop_deprecated_view in file babelfishpg_tsql--1.0.0--1.1.0.sql