Repository navigation
Support PostgreSQL ALTER DEFAULT PRIVILEGES - #2417
LucaCappelletti94 wants to merge 7 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 82.46% 82.52% +0.05%
==========================================
Files 42 42
Lines 35458 35621 +163
Branches 35458 35621 +163
==========================================
+ Hits 29242 29397 +155
- Misses 2679 2681 +2
- Partials 3537 3543 +6 ☔ 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.
d59af73 to
ba1d3c7
Compare
|
I have too many tabs open and I mistook this PR for another one. My bad. |
986c527 to
f7e8540
Compare
03c9978 to
a197eee
Compare
a197eee to
f278e71
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.