Repository navigation
Support PostgreSQL ALTER DEFAULT PRIVILEGES - #2417
LucaCappelletti94 wants to merge 2 commits into
Conversation
71004b0 to
72c56b7
Compare
b4a960e to
3facc79
Compare
3facc79 to
d40962c
Compare
1547f09 to
d586a2b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2417 +/- ##
==========================================
+ Coverage 81.28% 81.31% +0.03%
==========================================
Files 42 42
Lines 33920 34093 +173
Branches 33920 34093 +173
==========================================
+ Hits 27571 27724 +153
- Misses 2785 2791 +6
- Partials 3564 3578 +14 ☔ 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.
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.