-
Notifications
You must be signed in to change notification settings - Fork 848
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pg_dump test and make insert block trigger a non-internal trigger
Previously, the pg_dump test was broken because it is not possible to reference psql variables from inside bash commands run through psql. This is fixed by hardcoding the username passed to the bash commands inside the test. Also, we changed the insert block trigger preventing inserts into hypertable to a non-internal trigger, because internal triggers are not dumped by pg_dump. We need to dump the trigger so that it is already in place after a pg_restore, to prevent users from accidentally inserting rows into a hypertable while timescaledb_restoring=on.
- Loading branch information
Showing
10 changed files
with
86 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Trigger that blocks INSERTs on the hypertable's root table | ||
CREATE OR REPLACE FUNCTION _timescaledb_internal.insert_blocker() RETURNS trigger | ||
AS '@MODULE_PATHNAME@', 'hypertable_insert_blocker' LANGUAGE C; | ||
|
||
-- Drop all pre-0.11.1 insert_blockers from hypertables and add the new, visible trigger | ||
CREATE FUNCTION _timescaledb_internal.insert_blocker_trigger_add(relid REGCLASS) RETURNS OID | ||
AS '@MODULE_PATHNAME@', 'hypertable_insert_blocker_trigger_add' LANGUAGE C VOLATILE STRICT; | ||
|
||
SELECT _timescaledb_internal.insert_blocker_trigger_add(h.relid) | ||
FROM (SELECT format('%I.%I', schema_name, table_name)::regclass AS relid FROM _timescaledb_catalog.hypertable) AS h; | ||
|
||
DROP FUNCTION _timescaledb_internal.insert_blocker_trigger_add(REGCLASS); |
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
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
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