Re: [GENERAL] Bug with sequences in 6.4.2 - Mailing list pgsql-general

From wehner@digital-security.com (Stefan Wehner)
Subject Re: [GENERAL] Bug with sequences in 6.4.2
Date
Msg-id 19990311170816.4853D1518F@miraculix.shw.com
Whole thread Raw
List pgsql-general
Greetings,
I have found the place from which this bug seems to originate in
[6.4.2 sources]
backend/parser/parse_func.c
line #443 - #445

There is the call to
    text *lower(text *)

so probably any fix should start here.
Now what is the intended semantics/syntax for nextval(<ARG>) ?

e.g.
    a) nextval('AA'),
    b) nextval("AA")
or even
    c) nextval('"AA"')

a change to allow syntax a) might have the potential to break existing
assumptions about case-insensitiveness on behalf of nextval,
I would prefer a change that would allow
    nextval(aa) -- This will cause problems in the parser as a syntactic
                    -- element is removed
    nextval("AA")
something around this line of thought will make handling of identifiers
consistent again. Treat a string case-insensitive unless it is a quoted
identifier.
I had expected the ugly c) above to work, but currently there is no check if
the sequencename might be a quoted identifier.
I'm not sure if I have enough time to make a patch myself, as I'm not overly
confident to find my way through the intestines of the parser, but maybe one
of you can either think of a quick fix or point me to what needs to be
considered to implement a fix.

BTW, as this affects SERIAL, I consider this a definite showstopper for both
6.4.x and 6.5 ( that is if it is still present in there ).

Test Case from my earlier post should probably go into the Regress tests ASAP.

With Regards,
     Stefan Wehner








pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [INTERFACES] threads and libpq
Next
From: Ralf Weidemann
Date:
Subject: daily check for expired data ?