Thread

  1. create table bug with reserved words?

    Chris Storah <cstorah@emis-support.demon.co.uk> — 2001-02-15T13:12:03Z

    There seems to be an inconsistency in the parsing of create table (possibly
    other SQL syntax?):
    
    	create table test (call int, end, int, select int);
    Fails with ERROR: parser: parse error at or near "create"
    
    	create table test (call int, end1, int, select1 int);
    Works.
    
    Call, End and Select are reserved words, but why does 'Call' work and the
    others fail?
    Is this a bug - should the parser cope with any reserved words as
    identifiers?
    
    Thanks,
    Chris
    
    
    
    
    
    
  2. Re: create table bug with reserved words?

    Tom Lane <tgl@sss.pgh.pa.us> — 2001-02-15T15:22:41Z

    Chris Storah <cstorah@emis-support.demon.co.uk> writes:
    > Is this a bug - should the parser cope with any reserved words as
    > identifiers?
    
    No, and no.  If you could use them as identifiers then they wouldn't
    be reserved words, would they?
    
    Some keywords are "more reserved" than others in the Postgres parser;
    see the distinction between ColId and ColLabel in gram.y if you want
    the details.  AFAICT, "CALL" is not a keyword at all in Postgres.
    
    			regards, tom lane
    
    
  3. Re: create table bug with reserved words?

    Peter Eisentraut <peter_e@gmx.net> — 2001-02-15T18:00:17Z

    Chris Storah writes:
    
    > There seems to be an inconsistency in the parsing of create table (possibly
    > other SQL syntax?):
    >
    > 	create table test (call int, end, int, select int);
    > Fails with ERROR: parser: parse error at or near "create"
    
    SELECT is a reserved word.  The error message just shows that the parser
    is significantly confused.
    
    > 	create table test (call int, end1, int, select1 int);
    > Works.
    >
    > Call, End and Select are reserved words, but why does 'Call' work and the
    > others fail?
    > Is this a bug - should the parser cope with any reserved words as
    > identifiers?
    >
    > Thanks,
    > Chris
    >
    >
    >
    >
    >
    
    -- 
    Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/