Re: Making tab-complete.c easier to maintain

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Making tab-complete.c easier to maintain
Date: 2015-10-22 21:36:53
Message-ID: 51382.1445549813@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Oct 21, 2015 at 8:54 PM, Thomas Munro
> <thomas(dot)munro(at)enterprisedb(dot)com> wrote:
>> (Apologies for sending so many versions. tab-complete.c keeps moving
>> and I want to keep a version that applies on top of master out there,
>> for anyone interested in looking at this. As long as no one objects
>> and there is interest in the patch, I'll keep doing that.)

> I don't want to rain on the parade since other people seem to like
> this, but I'm sort of unimpressed by this. Yes, it removes >1000
> lines of code, and that's not nothing. But it's all mechanical code,
> so, not to be dismissive, but who really cares? Is it really worth
> replacing the existing notation that we all know with a new one that
> we have to learn? I'm not violently opposed if someone else wants to
> commit this, but I'm unexcited about it.

What I would like is to find a way to auto-generate basically this entire
file from gram.y. That would imply going over to something at least
somewhat parser-based, instead of the current way that is more or less
totally ad-hoc. That would be a very good thing though, because the
current way gives wrong answers not-infrequently, even discounting cases
that it's simply not been taught about.

I have no very good idea how to do that, though. Bison does have a
notion of which symbols are possible as the next symbol at any given
parse point, but it doesn't really make that accessible. There's a lack
of cooperation on the readline side too: we'd need to be able to see the
whole query buffer not just the current line.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-10-22 21:38:38 Re: Avoid full page images in streaming replication?
Previous Message Jim Nasby 2015-10-22 21:34:38 Avoid full page images in streaming replication?