Re: [HACKERS] parser problem

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: Michael Meskes <meskes(at)topsystem(dot)de>
Cc: PostgreSQL Hacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] parser problem
Date: 1998-04-23 02:10:46
Message-ID: 353EA326.4A3C047E@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Is it correct that the following two statements are equal?
> select "a" from foo;
> select a from foo;

Yes.

> That results in the following problem for ecpg:
> When I'm in SQL mode (that is after reading "exec sql") I do not get
> quotations. But what do I do with this?
>
> exec sql whenever sqlerror do printf("There was an error\n");
>
> Since my lex file is almost the same as scan.l I wonder if anyone has
> an idea.

What different kinds of clauses are available with the "whenever ...
do"? My Ingres manual indicates that the syntax is:

exec sql whenever <condition> <action>

where <condition> is one of:

sqlwarning
sqlerror
sqlmessage
not found
dbevent

and the <action> is one of:

continue
stop
goto <label>
call <procedure>

where <procedure> cannot be called with any arguments. This syntax would
be easy to parse with your existing lexer. My SQL books shows an even
more limited syntax with only "continue" and "goto" allowed.

If you want to allow some other syntax, including double-quoted strings,
then you will need to implement it explicitly in your grammar.

- Tom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-04-23 03:00:35 Re: [QUESTIONS] Anything like strftime() for PostgreSQL?
Previous Message ocie 1998-04-22 21:32:51 Re: [HACKERS] Re: hackers-digest V1 #771 (safe/fast I/O)