-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/trg fire only altered masks (#89)
* checkpoint to pause this work and cherry pick out trigger fix. * cherry pick only trigger fix. * schema updates
- Loading branch information
Showing
6 changed files
with
43 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# pgsodium extension | ||
comment = 'Postgres extension for libsodium functions' | ||
default_version = '3.1.7' | ||
default_version = '3.1.8' | ||
relocatable = false | ||
schema = pgsodium |
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,34 @@ | ||
|
||
CREATE OR REPLACE FUNCTION pgsodium.trg_mask_update() | ||
RETURNS EVENT_TRIGGER AS | ||
$$ | ||
DECLARE | ||
r record; | ||
BEGIN | ||
IF (SELECT bool_or(in_extension) FROM pg_event_trigger_ddl_commands()) THEN | ||
RAISE NOTICE 'skipping pgsodium mask regeneration in extension'; | ||
RETURN; | ||
END IF; | ||
|
||
FOR r IN | ||
SELECT e.* | ||
FROM pg_event_trigger_ddl_commands() e | ||
WHERE EXISTS ( | ||
SELECT FROM pg_catalog.pg_class c | ||
JOIN pg_catalog.pg_seclabel s ON s.classoid = c.tableoid | ||
AND s.objoid = c.oid | ||
WHERE c.tableoid = e.classid | ||
AND e.objid = c.oid | ||
AND s.provider = 'pgsodium' | ||
) | ||
LOOP | ||
IF r.object_type in ('table', 'table column') | ||
THEN | ||
PERFORM pgsodium.update_mask(r.objid); | ||
END IF; | ||
END LOOP; | ||
END | ||
$$ | ||
LANGUAGE plpgsql | ||
SET search_path='' | ||
; |
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