-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an issue where proconfig for functions was not reset with babelfi…
…sh installed (#2641) If babelfish is installed the set_sql_dialect is installed. That means we were never resetting the proconfig values for triggers/functions. One major symptom of this is mVU failure when there are some other extensions installed which change search path in proconfig. Task: BABEL-4982 Signed-off-by: Tanzeel Khan <[email protected]>
- Loading branch information
1 parent
eaf8f81
commit f07ca30
Showing
2 changed files
with
159 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
-- psql | ||
CREATE SCHEMA s1 | ||
GO | ||
|
||
CREATE TABLE s1.babel_4982_t (id VARCHAR(100)) | ||
GO | ||
|
||
|
||
|
||
CREATE FUNCTION babel_4982_ddl_trigger() | ||
RETURNS event_trigger AS | ||
$$ | ||
BEGIN | ||
INSERT INTO babel_4982_t VALUES (current_setting('search_path')); | ||
END; | ||
$$ | ||
SECURITY DEFINER | ||
SET search_path = s1, pg_catalog, pg_temp | ||
LANGUAGE plpgsql; | ||
CREATE EVENT TRIGGER babel_4982_ddl_trigger | ||
ON ddl_command_end | ||
EXECUTE PROCEDURE babel_4982_ddl_trigger(); | ||
SELECT set_config('search_path', 'master_dbo, sys, '||current_setting('search_path'), false); | ||
GO | ||
~~START~~ | ||
text | ||
master_dbo, sys, "$user", public | ||
~~END~~ | ||
|
||
|
||
SHOW search_path | ||
GO | ||
~~START~~ | ||
text | ||
master_dbo, sys, "$user", public | ||
~~END~~ | ||
|
||
|
||
CREATE TABLE babel_4982_t2 (id INT) | ||
GO | ||
|
||
SHOW search_path | ||
GO | ||
~~START~~ | ||
text | ||
master_dbo, sys, "$user", public | ||
~~END~~ | ||
|
||
|
||
BEGIN | ||
GO | ||
|
||
SHOW search_path | ||
GO | ||
~~START~~ | ||
text | ||
master_dbo, sys, "$user", public | ||
~~END~~ | ||
|
||
|
||
DROP TABLE babel_4982_t2 | ||
GO | ||
|
||
SHOW search_path | ||
GO | ||
~~START~~ | ||
text | ||
master_dbo, sys, "$user", public | ||
~~END~~ | ||
|
||
|
||
COMMIT | ||
GO | ||
|
||
-- two entries since two DDLs after trigger was created | ||
SELECT * FROM s1.babel_4982_t | ||
GO | ||
~~START~~ | ||
varchar | ||
s1, pg_catalog, pg_temp | ||
s1, pg_catalog, pg_temp | ||
~~END~~ | ||
|
||
|
||
DROP EVENT TRIGGER babel_4982_ddl_trigger | ||
GO | ||
|
||
DROP FUNCTION babel_4982_ddl_trigger | ||
GO | ||
|
||
DROP TABLE s1.babel_4982_t | ||
GO | ||
|
||
DROP SCHEMA s1 | ||
GO |
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,64 @@ | ||
-- psql | ||
CREATE SCHEMA s1 | ||
GO | ||
|
||
CREATE TABLE s1.babel_4982_t (id VARCHAR(100)) | ||
GO | ||
|
||
CREATE FUNCTION babel_4982_ddl_trigger() | ||
RETURNS event_trigger AS | ||
$$ | ||
BEGIN | ||
INSERT INTO babel_4982_t VALUES (current_setting('search_path')); | ||
END; | ||
$$ | ||
SECURITY DEFINER | ||
SET search_path = s1, pg_catalog, pg_temp | ||
LANGUAGE plpgsql; | ||
|
||
CREATE EVENT TRIGGER babel_4982_ddl_trigger | ||
ON ddl_command_end | ||
EXECUTE PROCEDURE babel_4982_ddl_trigger(); | ||
|
||
SELECT set_config('search_path', 'master_dbo, sys, '||current_setting('search_path'), false); | ||
GO | ||
|
||
SHOW search_path | ||
GO | ||
|
||
CREATE TABLE babel_4982_t2 (id INT) | ||
GO | ||
|
||
SHOW search_path | ||
GO | ||
|
||
BEGIN | ||
GO | ||
|
||
SHOW search_path | ||
GO | ||
|
||
DROP TABLE babel_4982_t2 | ||
GO | ||
|
||
SHOW search_path | ||
GO | ||
|
||
COMMIT | ||
GO | ||
|
||
-- two entries since two DDLs after trigger was created | ||
SELECT * FROM s1.babel_4982_t | ||
GO | ||
|
||
DROP EVENT TRIGGER babel_4982_ddl_trigger | ||
GO | ||
|
||
DROP FUNCTION babel_4982_ddl_trigger | ||
GO | ||
|
||
DROP TABLE s1.babel_4982_t | ||
GO | ||
|
||
DROP SCHEMA s1 | ||
GO |