psql, remove include of psqlscan.c - Mailing list pgsql-hackers

From Karl O. Pinc
Subject psql, remove include of psqlscan.c
Date
Msg-id 1348758002.32133.2@mofo
Whole thread Raw
Responses Re: psql, remove include of psqlscan.c
List pgsql-hackers
Hi,

This patch (psql_remove_include.patch) eliminates
the #include of psqlscan.c at the bottom of mainloop.c.

The attached patch uses the %top{} flex feature
introduced in flex 2.5.30 released 2003-4-1.
(See the NEWS file for flex.)

The good news is that config/programs.m4
requires flex >= 2.5.31.  The bad news
is that RHEL 5 (released 2007-03-14
with a 13 year (10+3 years) support lifecycle)
has a flex (2.5.4a) that is too old for this patch. :-(
(At least this is what the changelog in flex
from the RHEL 5 srpm repo tells me.)
I don't know what this means.

The flex docs on my box, fwiw, don't mention %top{}
in the section describing Posix (in)compatibility.

The patch is against git head.  All the tests
pass, fwiw.  Because this depends on the toolchain
it wouldn't hurt to build on other architectures/
operating systems.

I'm thinking of exposing enough of the psql parser,
moving it to libpq, that any client-side app can
do what libpq does; given a bunch of sql
separated by semi-colons get the results
of all the statements.  This should also allow
the "statement separation" to be done on the client
side in libpq.  Although I don't imagine that this
will have a performance impact on the server side
it sounds like a first step toward pushing more of
the parsing onto the client.

Regards,

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

P.S.  Sent this patch to the list at Sep 27 00:43:28 Central time
and it never showed up so I'm sending again with a different
subject.  Info on the previous message:

Subject:    Remove #include psqlscan.c from psql
message-id=<1348724599.28442.0@mofo>


Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: autovacuum stress-testing our system
Next
From: Tom Lane
Date:
Subject: Re: psql, remove include of psqlscan.c