Disallow "=" in names of reloptions and foreign-data options.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 Jun 2025 19:22:45 +0000 (15:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 2 Jun 2025 19:22:45 +0000 (15:22 -0400)
commiteb423464753f5a853ec47209aab05f74fafa9328
tree9289a1be1ced820e9a67e0a3b7cb151af8ded817
parentd4556f592eff4829012e3df72c48b9801a954297
Disallow "=" in names of reloptions and foreign-data options.

We store values for these options as array elements with the syntax
"name=value", hence a name containing "=" confuses matters when
it's time to read the array back in.  Since validation of the
options is often done (long) after this conversion to array format,
that leads to confusing and off-point error messages.  We can
improve matters by rejecting names containing "=" up-front.

(Probably a better design would have involved pairs of array
elements, but it's too late now --- and anyway, there's no
evident use-case for option names like this.  We already
reject such names in some other contexts such as GUCs.)

Reported-by: Chapman Flack <jcflack@acm.org>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chapman Flack <jcflack@acm.org>
Discussion: http://postgr.es/m/6830EB30.8090904@acm.org
Backpatch-through: 13
contrib/file_fdw/input/file_fdw.source
contrib/file_fdw/output/file_fdw.source
src/backend/access/common/reloptions.c
src/backend/commands/foreigncmds.c