From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Alanoly Andrews <alanolya(at)invera(dot)com> |
Cc: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Using a different column name in a foreign table |
Date: | 2022-01-21 18:46:42 |
Message-ID: | CAKFQuwZH998oOPzjpVdQryVs36ckxPOsaDaa8iam3pcMDraysA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, Jan 21, 2022 at 11:32 AM Alanoly Andrews <alanolya(at)invera(dot)com>
wrote:
> Thanks Adrian. I was aware of that.
>
> But...in the case of FT definition, the quotes are mandatory after
> column_name in options. And it is a single quote.
>
Using an unqualified "quote" is this kind of discussion should be avoided.
The option itself is just text. The system basically has two choices. Use
the text as-is for the identifier, in which case the user would have to
write '"NAME OF COLUMN"' (that's single-quote, double-quote, characters,
double-quote, single-quote) or, as Adrian just said, take the input string
and perform quoting on-the-fly into to turn it into a valid SQL identifier
(which is what quote_ident(text) does).
The later ends up being more user-friendly and prevents, however
unlikely in this situation, SQL-injection problems.
Since the second option preserves the supplied text as an explicit name it
indeed must be exactly what is required and one cannot rely on case-folding
behavior.
This seems like something that should be, but is not, documented for that
option.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-01-21 18:49:30 | Re: psql and Postgres 7.2 |
Previous Message | Adrian Klaver | 2022-01-21 18:41:18 | Re: Using a different column name in a foreign table |