pg_dump - foreign table - server name is not quoted

Started by Ronan Dunklauover 14 years ago4 messagesbugs
Jump to latest
#1Ronan Dunklau
rdunklau@gmail.com

Hello.

I noticed what I think is a bug in pg_dump.

When dumping foreign tables, the server name is not properly quoted,
which leads to unrestorable dumps.

eg, a foreign table attached to a foreign server named "file-test" is
dumped as:

CREATE FOREIGN TABLE "test-table" (
col1 integer
)
SERVER file-test
OPTIONS (filename '/tmp/test');

Please look at the attached test case and the proposed patch.

Thank you.

--
Ronan Dunklau

Attachments:

bug_dump_fdw.sqltext/x-sql; name=bug_dump_fdw.sqlDownload
bug_dump_foreign_server.patchtext/x-patch; name=bug_dump_foreign_server.patchDownload+2-1
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ronan Dunklau (#1)
Re: pg_dump - foreign table - server name is not quoted

Ronan Dunklau <rdunklau@gmail.com> writes:

When dumping foreign tables, the server name is not properly quoted,
which leads to unrestorable dumps.

Clearly a bug.

Please look at the attached test case and the proposed patch.

I think this patch is not in keeping with typical coding practices in
pg_dump. Usually we prefer to retrieve names from the server as-is,
then apply fmtId() when printing them --- this is more flexible than
having possibly-pre-quoted names in pg_dump's internal state.

Will fix it the latter way. Thanks for the report!

regards, tom lane

#3Ronan Dunklau
rdunklau@gmail.com
In reply to: Tom Lane (#2)
Re: pg_dump - foreign table - server name is not quoted

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks for the response.

How will this bug be handled with regards to releases ?

If the fix is going to take a while to be released, we could rename
our servers to valid names but we would prefer not to.

Regards,

- --
Ronan Dunklau
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iQEcBAEBAgAGBQJO08ABAAoJECTYLCgFy323h48H/2J88BTXgkKGjU6XQE+xkPiA
Ma9ekqsuPSYLzOv/j2lubK0P0M8CYdxgzAGQsMvhj7QZZFNhBsjBKI1fhIpxNwWw
B6/T9FRPTBS7lo2iurxK2TAcdoP2Vw76q/Nwja2DQLrwUXTztfwbP+DTTB/l0CmW
XF7BF5kS8wTnvqkqmQJaFPNefsoqh9OpyTroX0g+ul8cn9ZO3HwHtYDk1spQp3HQ
qPNAwiJaKMwnsAGqjH0qSiqtoHrSU7RxbDcKaUslI56Ba82JFD+FUErPEtuQA/q4
uX+bFgZz1K2+96s6+0ZdSccBDLCB/1o/zXAQrmJmTLUNbs9O+iSuG1v6OUMY2p0=
=QCSp
-----END PGP SIGNATURE-----

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ronan Dunklau (#3)
Re: pg_dump - foreign table - server name is not quoted

Ronan Dunklau <rdunklau@gmail.com> writes:

How will this bug be handled with regards to releases ?

It'll be fixed in next week's releases.

regards, tom lane