-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit for Babelfish v2.10 (#2665)
- Update Github action scripts - Create upgrade test folder and schedule file for last minor version. - Bump Babelfish version in babelfish_version.h and Version.config - Added upgrade script babelfishpg_tsql--2.9.0--2.10.0.sql Signed-off-by: Jason Teng <[email protected]>
- Loading branch information
Showing
9 changed files
with
508 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
contrib/babelfishpg_tsql/sql/upgrades/babelfishpg_tsql--2.9.0--2.10.0.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.