From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Adriaan van Os <adriaan(at)microbizz(dot)nl> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] [BUGS] BUG #2907: pg_get_serial_sequence quoting |
Date: | 2007-01-30 02:34:53 |
Message-ID: | 200701300234.l0U2Yr423647@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs pgsql-hackers pgsql-patches |
Adriaan van Os wrote:
> Tom Lane wrote:
> > Bruce Momjian <bruce(at)momjian(dot)us> writes:
> >>> I presume the reason for that is that the first paramater can be
> >>> qualified:
> >>> select pg_get_serial_sequence('"public"."FOO"', 'Ff1');
> >
> >> Would someone explain why qualification makes us lowercase the first
> >> parameter by default? I don't understand it well enough to document it.
> >
> > The point is that we have to parse the first parameter, whereas the
> > second one can be taken literally.
>
> It still looks inconsistent and ugly. I think the design mistake of pg_get_serial_sequence is that
> it takes two parameters rather than one (a fully qualified doublequoted columnname path) or three
> (optionally empty schema, tablename, columnname, all three literal).
I did my best to document the behavior of pg_get_serial_sequence().
There actually is a technical reason why we can't auto-quote the first
parameter. Patch applied to HEAD and 8.2.X.
Example of identifiers with embedded periods:
test=> CREATE TABLE "a.b" ("c.d" SERIAL);
NOTICE: CREATE TABLE will create implicit sequence "a.b_c.d_seq" for serial column "a.b.c.d"
CREATE TABLE
test=> SELECT pg_get_serial_sequence('a.b', 'c.d');
ERROR: schema "a" does not exist
test=> SELECT pg_get_serial_sequence('"a.b"', 'c.d');
pg_get_serial_sequence
------------------------
PUBLIC."a.b_c.d_seq"
(1 row)
test=> SELECT pg_get_serial_sequence('"a.b"', '"c.d"');
ERROR: column ""c.""d of relation "a.b" does not exist
--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachment | Content-Type | Size |
---|---|---|
/rtmp/diff | text/x-diff | 2.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-01-30 02:56:16 | Re: [BUGS] Missing error message on missing ssl-key-files |
Previous Message | Magnus Hagander | 2007-01-29 17:46:35 | Re: [BUGS] Missing error message on missing ssl-key-files |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-01-30 02:56:16 | Re: [BUGS] Missing error message on missing ssl-key-files |
Previous Message | Jim Nasby | 2007-01-30 02:31:13 | Re: Proposal: Change of pg_trigger.tg_enabled and adding |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavan Deolasee | 2007-01-30 09:52:32 | Lock compatibility matrix |
Previous Message | Bruce Momjian | 2007-01-29 21:02:07 | Re: [ADMIN] server process (PID xxx) was |