Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong column type in sys.sql_modules #2604

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions contrib/babelfishpg_tsql/sql/sys_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,6 @@ select
from sys.objects s;
GRANT SELECT ON sys.sysobjects TO PUBLIC;

-- TODO: BABEL-3127
CREATE OR REPLACE VIEW sys.all_sql_modules_internal AS
SELECT
ao.object_id AS object_id
Expand All @@ -1956,7 +1955,7 @@ SELECT
WHEN ao.type = 'V' THEN COALESCE(bvd.definition, '')
ELSE NULL
END
AS sys.nvarchar(4000)) AS definition -- Object definition work in progress, will update definition with BABEL-3127 Jira.
AS sys.nvarchar) AS definition
, CAST(1 as sys.bit) AS uses_ansi_nulls
, CAST(1 as sys.bit) AS uses_quoted_identifier
, CAST(0 as sys.bit) AS is_schema_bound
Expand Down Expand Up @@ -1991,7 +1990,7 @@ GRANT SELECT ON sys.all_sql_modules_internal TO PUBLIC;
CREATE OR REPLACE VIEW sys.all_sql_modules AS
SELECT
CAST(t1.object_id as int)
,CAST(t1.definition as sys.nvarchar(4000))
,CAST(t1.definition as sys.nvarchar)
,CAST(t1.uses_ansi_nulls as sys.bit)
,CAST(t1.uses_quoted_identifier as sys.bit)
,CAST(t1.is_schema_bound as sys.bit)
Expand All @@ -2006,7 +2005,7 @@ GRANT SELECT ON sys.all_sql_modules TO PUBLIC;
CREATE OR REPLACE VIEW sys.system_sql_modules AS
SELECT
CAST(t1.object_id as int)
,CAST(t1.definition as sys.nvarchar(4000))
,CAST(t1.definition as sys.nvarchar)
,CAST(t1.uses_ansi_nulls as sys.bit)
,CAST(t1.uses_quoted_identifier as sys.bit)
,CAST(t1.is_schema_bound as sys.bit)
Expand All @@ -2022,7 +2021,7 @@ GRANT SELECT ON sys.system_sql_modules TO PUBLIC;
CREATE OR REPLACE VIEW sys.sql_modules AS
SELECT
CAST(t1.object_id as int)
,CAST(t1.definition as sys.nvarchar(4000))
,CAST(t1.definition as sys.nvarchar)
,CAST(t1.uses_ansi_nulls as sys.bit)
,CAST(t1.uses_quoted_identifier as sys.bit)
,CAST(t1.is_schema_bound as sys.bit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,106 @@ END;
$$
LANGUAGE plpgsql STABLE;

ALTER VIEW sys.all_sql_modules_internal RENAME TO all_sql_modules_internal_deprecated_in_2_9_0;

CREATE OR REPLACE VIEW sys.all_sql_modules_internal AS
SELECT
ao.object_id AS object_id
, CAST(
CASE WHEN ao.type in ('P', 'FN', 'IN', 'TF', 'RF', 'IF', 'TR') THEN COALESCE(f.definition, '')
WHEN ao.type = 'V' THEN COALESCE(bvd.definition, '')
ELSE NULL
END
AS sys.nvarchar) AS definition
, CAST(1 as sys.bit) AS uses_ansi_nulls
, CAST(1 as sys.bit) AS uses_quoted_identifier
, CAST(0 as sys.bit) AS is_schema_bound
, CAST(0 as sys.bit) AS uses_database_collation
, CAST(0 as sys.bit) AS is_recompiled
, CAST(
CASE WHEN ao.type IN ('P', 'FN', 'IN', 'TF', 'RF', 'IF') THEN
CASE WHEN p.proisstrict THEN 1
ELSE 0
END
ELSE 0
END
AS sys.bit) as null_on_null_input
, null::integer as execute_as_principal_id
, CAST(0 as sys.bit) as uses_native_compilation
, CAST(ao.is_ms_shipped as INT) as is_ms_shipped
FROM sys.all_objects ao
LEFT OUTER JOIN sys.pg_namespace_ext nmext on ao.schema_id = nmext.oid
LEFT OUTER JOIN sys.babelfish_namespace_ext ext ON nmext.nspname = ext.nspname
LEFT OUTER JOIN sys.babelfish_view_def bvd
on (
ext.orig_name = bvd.schema_name AND
ext.dbid = bvd.dbid AND
ao.name = bvd.object_name
)
LEFT JOIN pg_proc p ON ao.object_id = CAST(p.oid AS INT)
LEFT JOIN sys.babelfish_function_ext f ON ao.name = f.funcname COLLATE "C" AND ao.schema_id::regnamespace::name = f.nspname
AND sys.babelfish_get_pltsql_function_signature(ao.object_id) = f.funcsignature COLLATE "C"
WHERE ao.type in ('P', 'RF', 'V', 'TR', 'FN', 'IF', 'TF', 'R');
GRANT SELECT ON sys.all_sql_modules_internal TO PUBLIC;

ALTER VIEW sys.all_sql_modules RENAME TO all_sql_modules_deprecated_in_2_9_0;

CREATE OR REPLACE VIEW sys.all_sql_modules AS
SELECT
CAST(t1.object_id as int)
,CAST(t1.definition as sys.nvarchar)
,CAST(t1.uses_ansi_nulls as sys.bit)
,CAST(t1.uses_quoted_identifier as sys.bit)
,CAST(t1.is_schema_bound as sys.bit)
,CAST(t1.uses_database_collation as sys.bit)
,CAST(t1.is_recompiled as sys.bit)
,CAST(t1.null_on_null_input as sys.bit)
,CAST(t1.execute_as_principal_id as int)
,CAST(t1.uses_native_compilation as sys.bit)
FROM sys.all_sql_modules_internal t1;
GRANT SELECT ON sys.all_sql_modules TO PUBLIC;

ALTER VIEW sys.system_sql_modules RENAME TO system_sql_modules_deprecated_in_2_9_0;

CREATE OR REPLACE VIEW sys.system_sql_modules AS
SELECT
CAST(t1.object_id as int)
,CAST(t1.definition as sys.nvarchar)
,CAST(t1.uses_ansi_nulls as sys.bit)
,CAST(t1.uses_quoted_identifier as sys.bit)
,CAST(t1.is_schema_bound as sys.bit)
,CAST(t1.uses_database_collation as sys.bit)
,CAST(t1.is_recompiled as sys.bit)
,CAST(t1.null_on_null_input as sys.bit)
,CAST(t1.execute_as_principal_id as int)
,CAST(t1.uses_native_compilation as sys.bit)
FROM sys.all_sql_modules_internal t1
WHERE t1.is_ms_shipped = 1;
GRANT SELECT ON sys.system_sql_modules TO PUBLIC;

ALTER VIEW sys.sql_modules RENAME TO sql_modules_deprecated_in_2_9_0;

CREATE OR REPLACE VIEW sys.sql_modules AS
SELECT
CAST(t1.object_id as int)
,CAST(t1.definition as sys.nvarchar)
,CAST(t1.uses_ansi_nulls as sys.bit)
,CAST(t1.uses_quoted_identifier as sys.bit)
,CAST(t1.is_schema_bound as sys.bit)
,CAST(t1.uses_database_collation as sys.bit)
,CAST(t1.is_recompiled as sys.bit)
,CAST(t1.null_on_null_input as sys.bit)
,CAST(t1.execute_as_principal_id as int)
,CAST(t1.uses_native_compilation as sys.bit)
FROM sys.all_sql_modules_internal t1
WHERE t1.is_ms_shipped = 0;
GRANT SELECT ON sys.sql_modules TO PUBLIC;

CALL sys.babelfish_drop_deprecated_object('view', 'sys', 'all_sql_modules_internal_deprecated_in_2_9_0');
CALL sys.babelfish_drop_deprecated_object('view', 'sys', 'all_sql_modules_deprecated_in_2_9_0');
CALL sys.babelfish_drop_deprecated_object('view', 'sys', 'system_sql_modules_deprecated_in_2_9_0');
CALL sys.babelfish_drop_deprecated_object('view', 'sys', 'sql_modules_deprecated_in_2_9_0');

-- 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DROP PROC IF EXISTS sys_all_sql_modules_dep_vu_prepare_p1;
DROP PROC IF EXISTS sys_all_sql_modules_dep_vu_prepare_p2;
DROP FUNCTION IF EXISTS sys_all_sql_modules_dep_vu_prepare_f2;
DROP FUNCTION IF EXISTS sys_all_sql_modules_dep_vu_prepare_f3;
DROP VIEW IF EXISTS sys_all_sql_modules_dep_vu_prepare_v1;
DROP VIEW IF EXISTS sys_all_sql_modules_dep_vu_prepare_v2;
DROP FUNCTION IF EXISTS sys_all_sql_modules_dep_vu_prepare_f1;
DROP PROCEDURE IF EXISTS sys_all_sql_modules_dep_more_than_4k;
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
CREATE FUNCTION sys_all_sql_modules_dep_vu_prepare_f1()
RETURNS INT
AS
BEGIN
RETURN 1;
END
GO

CREATE PROCEDURE sys_all_sql_modules_dep_more_than_4k
AS
BEGIN
SELECT 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
END
GO

CREATE PROC sys_all_sql_modules_dep_vu_prepare_p1 AS
SELECT
uses_ansi_nulls,
uses_quoted_identifier,
definition
FROM sys.all_sql_modules
WHERE object_id = OBJECT_ID('sys_all_sql_modules_dep_vu_prepare_f1')
GO

CREATE PROC sys_all_sql_modules_dep_vu_prepare_p2 AS
SELECT
uses_ansi_nulls,
uses_quoted_identifier,
definition
FROM sys.all_sql_modules
WHERE object_id = OBJECT_ID('sys_all_sql_modules_dep_more_than_4k')
GO

CREATE VIEW sys_all_sql_modules_dep_vu_prepare_v1 AS
SELECT
execute_as_principal_id,
uses_native_compilation,
definition
FROM sys.all_sql_modules
WHERE object_id = OBJECT_ID('sys_all_sql_modules_dep_vu_prepare_f1')
GO

CREATE VIEW sys_all_sql_modules_dep_vu_prepare_v2 AS
SELECT
execute_as_principal_id,
uses_native_compilation,
definition
FROM sys.all_sql_modules
WHERE object_id = OBJECT_ID('sys_all_sql_modules_dep_more_than_4k')
GO

CREATE FUNCTION sys_all_sql_modules_dep_vu_prepare_f2()
RETURNS INT
AS
BEGIN
RETURN (SELECT COUNT(*) FROM sys.all_sql_modules WHERE object_id = OBJECT_ID('sys_all_sql_modules_dep_vu_prepare_f1'))
END
GO

CREATE FUNCTION sys_all_sql_modules_dep_vu_prepare_f3()
RETURNS INT
AS
BEGIN
RETURN (SELECT COUNT(*) FROM sys.all_sql_modules WHERE object_id = OBJECT_ID('sys_all_sql_modules_dep_more_than_4k'))
END
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
EXEC sys_all_sql_modules_dep_vu_prepare_p1;
GO
~~START~~
bit#!#bit#!#nvarchar
1#!#1#!#
~~END~~


EXEC sys_all_sql_modules_dep_vu_prepare_p2;
GO
~~START~~
bit#!#bit#!#nvarchar
1#!#1#!#
~~END~~


SELECT * FROM sys_all_sql_modules_dep_vu_prepare_f2();
GO
~~START~~
int
1
~~END~~


SELECT * FROM sys_all_sql_modules_dep_vu_prepare_f3();
GO
~~START~~
int
1
~~END~~


SELECT * FROM sys_all_sql_modules_dep_vu_prepare_v1;
GO
~~START~~
int#!#bit#!#nvarchar
<NULL>#!#0#!#
~~END~~


SELECT * FROM sys_all_sql_modules_dep_vu_prepare_v2;
GO
~~START~~
int#!#bit#!#nvarchar
<NULL>#!#0#!#
~~END~~

3 changes: 3 additions & 0 deletions test/JDBC/expected/sys-all_sql_modules-dep-vu-cleanup.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
DROP PROC IF EXISTS sys_all_sql_modules_dep_vu_prepare_p1;
DROP PROC IF EXISTS sys_all_sql_modules_dep_vu_prepare_p2;
DROP FUNCTION IF EXISTS sys_all_sql_modules_dep_vu_prepare_f2;
DROP FUNCTION IF EXISTS sys_all_sql_modules_dep_vu_prepare_f3;
DROP VIEW IF EXISTS sys_all_sql_modules_dep_vu_prepare_v1;
DROP FUNCTION IF EXISTS sys_all_sql_modules_dep_vu_prepare_f1;
DROP PROCEDURE IF EXISTS sys_all_sql_modules_dep_more_than_4k;
GO
Loading
Loading