psql, remove include of psqlscan.c

From: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: psql, remove include of psqlscan.c
Date: 2012-09-27 15:00:02
Message-ID: 1348758002.32133.2@mofo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)meme(dot)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(dot)28442(dot)0(at)mofo>

Attachment Content-Type Size
psql_remove_include.patch text/x-patch 2.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-09-27 15:07:48 Re: psql, remove include of psqlscan.c
Previous Message Alvaro Herrera 2012-09-27 14:57:24 Re: autovacuum stress-testing our system