forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3352c23
committed
Fix privilege dumping from servers too old to have that type of privilege.
pg_dump produced fairly silly GRANT/REVOKE commands when dumping types frompre-9.2 servers, and when dumping functions or procedural languages frompre-7.3 servers. Those server versions lack the typacl, proacl, and/orlanacl columns respectively, and pg_dump substituted default values thatwere in fact incorrect. We ended up revoking all the owner's ownprivileges for the object while granting all privileges to PUBLIC.Of course the owner would then have those privileges again via PUBLIC, solong as she did not try to revoke PUBLIC's privileges; which may explainthe lack of field reports. Nonetheless this is pretty silly behavior.The stakes were raised by my recent patch to make pg_dump dump shell types,because 9.2 and up pg_dump would proceed to emit bogus GRANT/REVOKEcommands for a shell type if dumping from a pre-9.2 server; and the serverwill not accept GRANT/REVOKE commands for a shell type. (Perhaps itshould, but that's a topic for another day.) So the resulting dump scriptwouldn't load without errors.The right thing to do is to act as though these objects have defaultprivileges (null ACL entries), which causes pg_dump to print noGRANT/REVOKE commands at all for them. That fixes the silly resultsand also dodges the problem with shell types.In passing, modify getProcLangs() to be less creatively different abouthow to handle missing columns when dumping from older server versions.Every other data-acquisition function in pg_dump does that by substitutingappropriate default values in the version-specific SQL commands, and I seeno reason why this one should march to its own drummer. Its use of"SELECT *" was likewise not conformant with anyplace else, not to mentionit's not considered good SQL style for production queries.Back-patch to all supported versions. Although 9.0 and 9.1 pg_dump don'thave the issue with typacl, they are more likely than newer versions to beused to dump from ancient servers, so we ought to fix the proacl/lanaclissues all the way back.1 parent7e0add3 commit3352c23
1 file changed
+47
-38
lines changedLines changed: 47 additions & 38 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3268 | 3268 |
| |
3269 | 3269 |
| |
3270 | 3270 |
| |
3271 |
| - | |
| 3271 | + | |
3272 | 3272 |
| |
3273 | 3273 |
| |
3274 | 3274 |
| |
| |||
3283 | 3283 |
| |
3284 | 3284 |
| |
3285 | 3285 |
| |
3286 |
| - | |
| 3286 | + | |
3287 | 3287 |
| |
3288 | 3288 |
| |
3289 | 3289 |
| |
| |||
3297 | 3297 |
| |
3298 | 3298 |
| |
3299 | 3299 |
| |
3300 |
| - | |
| 3300 | + | |
3301 | 3301 |
| |
3302 | 3302 |
| |
3303 | 3303 |
| |
| |||
3313 | 3313 |
| |
3314 | 3314 |
| |
3315 | 3315 |
| |
3316 |
| - | |
| 3316 | + | |
3317 | 3317 |
| |
3318 | 3318 |
| |
3319 | 3319 |
| |
| |||
4004 | 4004 |
| |
4005 | 4005 |
| |
4006 | 4006 |
| |
4007 |
| - | |
| 4007 | + | |
4008 | 4008 |
| |
4009 | 4009 |
| |
4010 | 4010 |
| |
| |||
4019 | 4019 |
| |
4020 | 4020 |
| |
4021 | 4021 |
| |
4022 |
| - | |
| 4022 | + | |
4023 | 4023 |
| |
4024 | 4024 |
| |
4025 | 4025 |
| |
| |||
4163 | 4163 |
| |
4164 | 4164 |
| |
4165 | 4165 |
| |
4166 |
| - | |
| 4166 | + | |
4167 | 4167 |
| |
4168 | 4168 |
| |
4169 | 4169 |
| |
| |||
4179 | 4179 |
| |
4180 | 4180 |
| |
4181 | 4181 |
| |
4182 |
| - | |
| 4182 | + | |
4183 | 4183 |
| |
4184 | 4184 |
| |
4185 | 4185 |
| |
| |||
6014 | 6014 |
| |
6015 | 6015 |
| |
6016 | 6016 |
| |
6017 |
| - | |
| 6017 | + | |
6018 | 6018 |
| |
6019 | 6019 |
| |
6020 | 6020 |
| |
| |||
6026 | 6026 |
| |
6027 | 6027 |
| |
6028 | 6028 |
| |
6029 |
| - | |
| 6029 | + | |
6030 | 6030 |
| |
6031 | 6031 |
| |
6032 | 6032 |
| |
| |||
6036 | 6036 |
| |
6037 | 6037 |
| |
6038 | 6038 |
| |
6039 |
| - | |
| 6039 | + | |
| 6040 | + | |
| 6041 | + | |
6040 | 6042 |
| |
6041 | 6043 |
| |
6042 | 6044 |
| |
| |||
6046 | 6048 |
| |
6047 | 6049 |
| |
6048 | 6050 |
| |
6049 |
| - | |
| 6051 | + | |
| 6052 | + | |
| 6053 | + | |
6050 | 6054 |
| |
6051 | 6055 |
| |
6052 | 6056 |
| |
6053 | 6057 |
| |
6054 | 6058 |
| |
6055 | 6059 |
| |
6056 |
| - | |
| 6060 | + | |
6057 | 6061 |
| |
6058 | 6062 |
| |
6059 |
| - | |
6060 |
| - | |
6061 |
| - | |
| 6063 | + | |
| 6064 | + | |
| 6065 | + | |
| 6066 | + | |
| 6067 | + | |
| 6068 | + | |
| 6069 | + | |
| 6070 | + | |
| 6071 | + | |
| 6072 | + | |
| 6073 | + | |
| 6074 | + | |
| 6075 | + | |
| 6076 | + | |
| 6077 | + | |
| 6078 | + | |
| 6079 | + | |
6062 | 6080 |
| |
6063 | 6081 |
| |
6064 | 6082 |
| |
6065 |
| - | |
6066 |
| - | |
6067 |
| - | |
6068 |
| - | |
6069 |
| - | |
| 6083 | + | |
| 6084 | + | |
| 6085 | + | |
| 6086 | + | |
| 6087 | + | |
| 6088 | + | |
| 6089 | + | |
| 6090 | + | |
| 6091 | + | |
6070 | 6092 |
| |
6071 | 6093 |
| |
6072 | 6094 |
| |
| |||
6082 | 6104 |
| |
6083 | 6105 |
| |
6084 | 6106 |
| |
6085 |
| - | |
6086 | 6107 |
| |
6087 | 6108 |
| |
6088 | 6109 |
| |
| |||
6098 | 6119 |
| |
6099 | 6120 |
| |
6100 | 6121 |
| |
6101 |
| - | |
6102 |
| - | |
6103 |
| - | |
6104 |
| - | |
6105 |
| - | |
6106 |
| - | |
6107 |
| - | |
6108 |
| - | |
6109 |
| - | |
6110 |
| - | |
6111 |
| - | |
6112 |
| - | |
6113 |
| - | |
6114 |
| - | |
6115 |
| - | |
6116 |
| - | |
| 6122 | + | |
| 6123 | + | |
| 6124 | + | |
| 6125 | + | |
6117 | 6126 |
| |
6118 | 6127 |
| |
6119 | 6128 |
| |
|
0 commit comments
Comments
(0)