Repository navigation
Support PostgreSQL ALTER DEFAULT PRIVILEGES - #2417
LucaCappelletti94 wants to merge 4 commits into
Conversation
71004b0 to
72c56b7
Compare
b4a960e to
3facc79
Compare
3facc79 to
d40962c
Compare
1547f09 to
d586a2b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2417 +/- ##
==========================================
+ Coverage 81.52% 81.62% +0.09%
==========================================
Files 42 42
Lines 34205 34368 +163
Branches 34205 34368 +163
==========================================
+ Hits 27885 28052 +167
Misses 2770 2770
+ Partials 3550 3546 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
afa4119 to
a1d021b
Compare
a1d021b to
8b3fff8
Compare
8b3fff8 to
ff7e1b9
Compare
sabir-akhadov-localstack
left a comment
There was a problem hiding this comment.
Two non-blocking comments inline.
| (Keyword::FUNCTIONS, DefaultPrivilegesObjectType::Functions), | ||
| (Keyword::ROUTINES, DefaultPrivilegesObjectType::Routines), | ||
| (Keyword::TYPES, DefaultPrivilegesObjectType::Types), | ||
| (Keyword::SCHEMAS, DefaultPrivilegesObjectType::Schemas), |
There was a problem hiding this comment.
The current docs also list ON LARGE OBJECTS (PG 17+), so ALTER DEFAULT PRIVILEGES GRANT SELECT, UPDATE ON LARGE OBJECTS TO app fails here; a LargeObjects variant matched via parse_keywords(&[LARGE, OBJECTS]) would cover it.
| vec![] | ||
| }; | ||
|
|
||
| let in_schemas = if self.parse_keywords(&[Keyword::IN, Keyword::SCHEMA]) { |
There was a problem hiding this comment.
DefACLOptionList in gram.y is an unordered list, so ALTER DEFAULT PRIVILEGES IN SCHEMA s FOR ROLE r GRANT SELECT ON TABLES TO app is valid PG but fails here with Expected: GRANT or REVOKE; looping over the two options until neither matches would accept it. pg_dump always emits FOR ROLE first, so non-blocking.
There was a problem hiding this comment.
FOR ROLE and IN SCHEMA are now one ordered option list, so either order parses and prints as written, and repeatitions are rejected, as PostgreSQL does.
8598125 to
d59af73
Compare
ALTER DEFAULT PRIVILEGESwas not a recognisedALTERtarget, so it failed at theDEFAULTkeyword.The statement now parses into
AlterDefaultPrivileges, carrying the optionalFOR ROLEandIN SCHEMAlists and the abbreviatedGRANTorREVOKE, so it round trips rather than being consumed and discarded.I tried to maximize code reuse from analogous structs.
All of these PRs come from trying to parse
pg_dump -soutputs.