-
Notifications
You must be signed in to change notification settings - Fork 94
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
2jungkook
merged 6 commits into
babelfish-for-postgresql:BABEL_2_X_DEV
from
amazon-aurora:babel-2-10-init
Jun 13, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2ff205c
Initial commit for Babelfish v2.10
5e5574d
Update expected_drop.out
6f6d897
Remove invalid tests from 14_12 schedule file
0a3231a
Fix BABEL-3514 test to account for 2-digit minor version
d570548
Typo
88a9a88
Remove more invalid 14.12 upgrade tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.