Thread: pg_dump - foreign table - server name is not quoted

pg_dump - foreign table - server name is not quoted

From
Ronan Dunklau
Date:
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

Attachment

Re: pg_dump - foreign table - server name is not quoted

From
Tom Lane
Date:
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

Re: pg_dump - foreign table - server name is not quoted

From
Ronan Dunklau
Date:
-----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-----

Re: pg_dump - foreign table - server name is not quoted

From
Tom Lane
Date:
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