Re: Change format of FDW options used in \d* commands - Mailing list pgsql-hackers

From Shigeru Hanada
Subject Re: Change format of FDW options used in \d* commands
Date
Msg-id 4E4E0E6F.5000608@gmail.com
Whole thread Raw
In response to Re: Change format of FDW options used in \d* commands  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Change format of FDW options used in \d* commands
Re: Change format of FDW options used in \d* commands
List 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

pgsql-hackers by date:

Previous
From: EazonGuo
Date:
Subject: how to get the effected row after execute a query
Next
From: Pavel Stehule
Date:
Subject: Re: how to get the effected row after execute a query