forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbabf38e
committed
Teach flatten_reloptions() to quote option values safely.
flatten_reloptions() supposed that it didn't really need to do anythingbeyond inserting commas between reloption array elements. However, inprinciple the value of a reloption could be nearly anything, since thegrammar allows a quoted string there. Any restrictions on it would comefrom validity checking appropriate to the particular option, if any.A reloption value that isn't a simple identifier or number could thus leadto dump/reload failures due to syntax errors in CREATE statements issuedby pg_dump. We've gotten away with not worrying about this so far withthe core-supported reloptions, but extensions might allow reloption valuesthat cause trouble, as in bug #13840 from Kouhei Sutou.To fix, split the reloption array elements explicitly, and then convertany value that doesn't look like a safe identifier to a string literal.(The details of the quoting rule could be debated, but this way is safeand requires little code.) While we're at it, also quote reloption namesif they're not safe identifiers; that may not be a likely problem in thefield, but we might as well try to be bulletproof here.It's been like this for a long time, so back-patch to all supportedbranches.Kouhei Sutou, adjusted some by me1 parent9411446 commitbabf38e
1 file changed
+52
-11
lines changedLines changed: 52 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9125 | 9125 |
| |
9126 | 9126 |
| |
9127 | 9127 |
| |
9128 |
| - | |
9129 |
| - | |
| 9128 | + | |
| 9129 | + | |
| 9130 | + | |
| 9131 | + | |
9130 | 9132 |
| |
9131 |
| - | |
9132 |
| - | |
9133 |
| - | |
9134 |
| - | |
9135 |
| - | |
9136 |
| - | |
9137 |
| - | |
9138 |
| - | |
9139 |
| - | |
| 9133 | + | |
| 9134 | + | |
| 9135 | + | |
| 9136 | + | |
| 9137 | + | |
| 9138 | + | |
| 9139 | + | |
| 9140 | + | |
| 9141 | + | |
| 9142 | + | |
| 9143 | + | |
| 9144 | + | |
| 9145 | + | |
| 9146 | + | |
| 9147 | + | |
| 9148 | + | |
| 9149 | + | |
| 9150 | + | |
| 9151 | + | |
| 9152 | + | |
| 9153 | + | |
| 9154 | + | |
| 9155 | + | |
| 9156 | + | |
| 9157 | + | |
| 9158 | + | |
| 9159 | + | |
| 9160 | + | |
| 9161 | + | |
| 9162 | + | |
| 9163 | + | |
| 9164 | + | |
| 9165 | + | |
| 9166 | + | |
| 9167 | + | |
| 9168 | + | |
| 9169 | + | |
| 9170 | + | |
| 9171 | + | |
| 9172 | + | |
| 9173 | + | |
| 9174 | + | |
| 9175 | + | |
| 9176 | + | |
| 9177 | + | |
| 9178 | + | |
| 9179 | + | |
| 9180 | + | |
9140 | 9181 |
| |
9141 | 9182 |
| |
9142 | 9183 |
| |
|
0 commit comments
Comments
(0)