Re: Change format of FDW options used in \d* commands

From: Shigeru Hanada <shigeru(dot)hanada(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Change format of FDW options used in \d* commands
Date: 2011-08-19 07:19:11
Message-ID: 4E4E0E6F.5000608@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(2011/08/18 23:21), Robert Haas wrote:
> ISTM you should do quote_ident() on the option names. For example, after:
>
> create foreign data wrapper dummy;
> create server s1 foreign data wrapper dummy;
> create foreign table ft1 (a int) server s1 options ("(" ')');
>
> With your patch, I get:
>
> rhaas=# \d+ ft1
> Foreign table "public.ft1"
> Column | Type | Modifiers | FDW Options | Storage | Description
> --------+---------+-----------+-------------+---------+-------------
> a | integer | | | plain |
> Server: s1
> FDW Options: (( ')')
> Has OIDs: no
>

Oops, good catch. I've fixed psql to use quote_ident() for option_name,
and modified regression tests to use special characters in option names.
Please try revised version of patch.

BTW, I noticed that pg_dump has same issue since 8.4, initial release of
SQL/MED infrastructure. If a FDW option was defined on any FDW object
with a name which contains one of special characters such as space and
parentheses, pg_dump generates invalid OPTIONS clause such as "OPTIONS
(separated name 'value')".
~~~~~~~~~~~~~~
Perhaps this issue has been overlooked because dblink is practically the
only use case of FDW option before 9.1. Since 9.1, users might get
various FDW and some of those might use special characters in option
name. ISTM that this fix should be back-patched, at least to 9.1.
Please find attached patches for each STABLE branch.

Regards,
--
Shigeru Hanada

Attachment Content-Type Size
20110819_fdw_option_format.patch text/plain 58.3 KB
pg_dump_quote_option_name_84.patch text/plain 2.4 KB
pg_dump_quote_option_name_90.patch text/plain 2.5 KB
pg_dump_quote_option_name_91.patch text/plain 4.1 KB
pg_dump_quote_option_name_92.patch text/plain 5.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2011-08-19 07:26:50 Re: how to get the effected row after execute a query
Previous Message EazonGuo 2011-08-19 07:16:32 how to get the effected row after execute a query