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

Initial commit for Babelfish v2.10 #2665

Merged
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
12 changes: 12 additions & 0 deletions .github/configuration/upgrade-test-configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ upgrade-version: [{
}
]
},
{
upgrade-path: [
{
version: '14.12',
upgrade-type: null
},
{
version: target.latest,
upgrade-type: minor
}
]
},
{
upgrade-path: [
{
Expand Down
3 changes: 3 additions & 0 deletions .github/template/version-branch-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
'14.11':
engine_branch: BABEL_2_8_STABLE__PG_14_11
extension_branch: BABEL_2_8_STABLE
'14.12':
engine_branch: BABEL_2_9_STABLE__PG_14_12
extension_branch: BABEL_2_9_STABLE
'source.latest':
engine_branch: latest
extension_branch: latest
Expand Down
2 changes: 1 addition & 1 deletion contrib/babelfishpg_tsql/Version.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# places during the build process

PGTSQL_MAJOR_VERSION=2
PGTSQL_MINOR_VERSION=9
PGTSQL_MINOR_VERSION=10
PGTSQL_MICRO_VERSION=0

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
-- complain if script is sourced in psql, rather than via ALTER EXTENSION
\echo Use "ALTER EXTENSION ""babelfishpg_tsql"" UPDATE TO '2.10.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);

-- This is a temporary procedure which is called during upgrade to update guest schema
-- for the guest users in the already existing databases
Comment on lines +7 to +8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need more explanation on why we need to do this for every upgrade script.

CREATE OR REPLACE PROCEDURE sys.babelfish_update_user_catalog_for_guest_schema()
LANGUAGE C
AS 'babelfishpg_tsql', 'update_user_catalog_for_guest_schema';

CALL sys.babelfish_update_user_catalog_for_guest_schema();

-- Drop this procedure after it gets executed once.
DROP PROCEDURE sys.babelfish_update_user_catalog_for_guest_schema();

-- 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.
*/



-- 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);
4 changes: 2 additions & 2 deletions contrib/babelfishpg_tsql/src/babelfish_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*-------------------------------------------------------------------------
*/

#define BABELFISH_VERSION_STR "2.9.0"
#define BABELFISH_INTERNAL_VERSION_STR "Babelfish 14.12.0.0"
#define BABELFISH_VERSION_STR "2.10.0"
#define BABELFISH_INTERNAL_VERSION_STR "Babelfish 14.13.0.0"
#define BABEL_COMPATIBILITY_VERSION "12.0.2000.8"
#define BABEL_COMPATIBILITY_MAJOR_VERSION "12"
3 changes: 2 additions & 1 deletion test/JDBC/expected/BABEL-3514.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- psql
select
cast(case when cast(sys.SERVERPROPERTY('BabelfishVersion') as varchar(20)) LIKE '_._._'
cast(case when (cast(sys.SERVERPROPERTY('BabelfishVersion') as varchar(20)) LIKE '_._._' OR
cast(sys.SERVERPROPERTY('BabelfishVersion') as varchar(20)) LIKE '_.__._' )
THEN 'valid babelfish version'
else 'invalid babelfish version' end as text);
GO
Expand Down
3 changes: 2 additions & 1 deletion test/JDBC/input/BABEL-3514.mix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- psql
select
cast(case when cast(sys.SERVERPROPERTY('BabelfishVersion') as varchar(20)) LIKE '_._._'
cast(case when (cast(sys.SERVERPROPERTY('BabelfishVersion') as varchar(20)) LIKE '_._._' OR
cast(sys.SERVERPROPERTY('BabelfishVersion') as varchar(20)) LIKE '_.__._' )
THEN 'valid babelfish version'
else 'invalid babelfish version' end as text);
GO
Loading
Loading