Re: psql, remove include of psqlscan.c

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql, remove include of psqlscan.c
Date: 2012-09-27 18:02:14
Message-ID: 1348768934.32133.13@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/27/2012 11:02:42 AM, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:

> A larger point is that I don't believe this is actually going to help
> anybody, because of mismatch of requirements not only implementation
> language. JDBC couldn't use a libpq lexer implementation even
> without
> the language issue, because the context in which they're arguing
> about
> this is finding and replacing JDBC-spec escape sequences, which libpq
> is
> not going to know about. I imagine PHP has got the same problem only
> different. Conversely, psql's lexer has a lot of psql-specific
> design
> decisions, such as the need to handle backslash commands and include
> files, that I don't think would belong in a libpq implementation.

Well no, I'm not at all interested in escape sequences.
I want to take sql directly from the user and execute it.
Right now I can take only one statement at a time.
And this is true of any human-facing application.

I'm not looking for a general purpose solution, although
it did occur to me that the psql variable substitution
mechanism could be exposed.

But what I really want is not "an exposed parser". What
I really want is to be able to get results from all the
statements passed to PQexec (et-al), not just the
last statement. This could be done without exposing
the parser, but it does mean having a parser in libpq.
Since psql links to libpq anyway my plan was to
move the parser entirely out of psql into libpq and
have an undocumented internal interface so that
psql can do the escaping/variable substitution stuff.

Regards,

Karl <kop(at)meme(dot)com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Karl O. Pinc 2012-09-27 18:06:34 Re: psql, remove include of psqlscan.c
Previous Message David Johnston 2012-09-27 17:08:13 Re: Oid registry