forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc7e27be
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 parent3c93a60 commitc7e27be
1 file changed
+52
-11
lines changedLines changed: 52 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9858 | 9858 |
| |
9859 | 9859 |
| |
9860 | 9860 |
| |
9861 |
| - | |
9862 |
| - | |
| 9861 | + | |
| 9862 | + | |
| 9863 | + | |
| 9864 | + | |
9863 | 9865 |
| |
9864 |
| - | |
9865 |
| - | |
9866 |
| - | |
9867 |
| - | |
9868 |
| - | |
9869 |
| - | |
9870 |
| - | |
9871 |
| - | |
9872 |
| - | |
| 9866 | + | |
| 9867 | + | |
| 9868 | + | |
| 9869 | + | |
| 9870 | + | |
| 9871 | + | |
| 9872 | + | |
| 9873 | + | |
| 9874 | + | |
| 9875 | + | |
| 9876 | + | |
| 9877 | + | |
| 9878 | + | |
| 9879 | + | |
| 9880 | + | |
| 9881 | + | |
| 9882 | + | |
| 9883 | + | |
| 9884 | + | |
| 9885 | + | |
| 9886 | + | |
| 9887 | + | |
| 9888 | + | |
| 9889 | + | |
| 9890 | + | |
| 9891 | + | |
| 9892 | + | |
| 9893 | + | |
| 9894 | + | |
| 9895 | + | |
| 9896 | + | |
| 9897 | + | |
| 9898 | + | |
| 9899 | + | |
| 9900 | + | |
| 9901 | + | |
| 9902 | + | |
| 9903 | + | |
| 9904 | + | |
| 9905 | + | |
| 9906 | + | |
| 9907 | + | |
| 9908 | + | |
| 9909 | + | |
| 9910 | + | |
| 9911 | + | |
| 9912 | + | |
| 9913 | + | |
9873 | 9914 |
| |
9874 | 9915 |
| |
9875 | 9916 |
| |
|
0 commit comments
Comments
(0)