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

From Bruce Momjian
Subject Re: [GENERAL] Bug with sequences in 6.4.2
Date
Msg-id 199903151555.KAA14357@candle.pha.pa.us
Whole thread Raw
Responses Re: [HACKERS] Re: [GENERAL] Bug with sequences in 6.4.2
Re: [HACKERS] Re: [GENERAL] Bug with sequences in 6.4.2
List pgsql-hackers
> Greetings,
> there seems to be a slight bug in the parsing of the
> nextval function, tested under 6.4.2.
> It affects also the SERIAL type.
> 
> Symptom :
> 
> CREATE SEQUENCE "AA";
> -- Correct, quoted identifier is allowed;
> SELECT NEXTVAL('AA');
> --Produces Error
> --aa.nextval: sequence does not exist
> 

Let me comment on this.    In the first statement, "AA" is used in an
SQL command, and we handle this correctly.  In the second case, NEXTVAL
is a function, called with a string.

Now in parse_func.c, we convert 'AA' to lower to try and find the
sequence table.  My assumption is that we should attempt to find the
table without doing a lower(), and if that fails, try lower.

Does that make sense to people.  We can't just lower it in every case.



> 
> Probable source of problem, the Argument to nextval is
> not handled correctly as an Table Identifier.
> 
> E.g. nextval('"AA"') is generates 
> "aa".nextval: sequence does not exist
> 
> Note the lowercase between the quotes.
> 
> I quickly browsed the sources, but have not found the
> place where the conversion to lowercase occurs.
> 
> Please check this against 6.5 and 6.4.3 too.
> 
> With Regards,
>     Stefan Wehner
> 
> 
> 
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: Oleg Broytmann
Date:
Subject: Re: [HACKERS] VACUUM ANALYZE problem on linux
Next
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] libpq and SPI