ECPG - Keywords as variable names (7.4 regression)

From: Gavin Scott <gavin(at)ipalsoftware(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: ECPG - Keywords as variable names (7.4 regression)
Date: 2003-10-10 18:49:29
Message-ID: 1065811768.30241.23.camel@hesse
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Gavin Scott
Your email address : gavin(at)ipalsoftware(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.20

PostgreSQL version (example: PostgreSQL-7.3): PostgreSQL-7.4beta4

Compiler used (example: gcc 2.95.2) : gcc 2.96

Please enter a FULL description of your problem:
------------------------------------------------

Certain keywords (specifically unreserved_keyword, reserved_keyword,
and ECPGkeywords_rest in preproc.y) produce a syntax error when used
as variable names in sql struct definitions.

These keywords are accepted as variable names in declare sections.
The difference appears to be that the lexer is in C mode within
declare sections which causes the keywords to be returned as IDENT
tokens. Within sql struct sections the lexer is in SQL mode and
returns them as keyword tokens (i.e. INDEX for index, etc).

This is a regression; ecpg has no problems processing the sample code
below in PostgreSQL version 7.3.4. and under.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

int main()
{
/* no problem with keywords as variable names in declare section */
exec sql begin declare section;
int index;
int explain;
exec sql end declare section;

/* keywords here cause ecpg syntax error (worked in PostgreSQL
version 7.3.4 and under) */
exec sql type struct_t is struct
{
int index;
int explain;
};

return 0;
}

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Browse pgsql-bugs by date

  From Date Subject
Next Message Dmitry Tkach 2003-10-10 19:26:13 Partial indices...
Previous Message Andreas Pflug 2003-10-10 16:18:57 Re: [BUGS] bug reporting