Gram.y patches for better parenthesis handling.

From: "Kevin O'Gorman" <kogorman(at)pacbell(dot)net>
To: PGSQL Hackers List <pgsql-hackers(at)hub(dot)org>
Subject: Gram.y patches for better parenthesis handling.
Date: 2000-10-28 01:11:00
Message-ID: 39FA27A4.A68C08DD@pacbell.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Okay, here's my attempt at fixing the problems with parentheses in
subqueries. It passes the normal 'runcheck' tests, and I've tried
a few simple things like
select 1 as foo union (((((select 2))))) order by foo;

There are a few things that it doesn't do that have been talked
about here at least a little:

1) It doesn't allow things like "IN(((select 1)))" -- the select
here has to be at the top level. This is not new.

2) It does NOT preserve the odd syntax I found when I started looking
at this, where a SELECT statement could begin with parentheses. Thus,
(SELECT a from foo) order by a;
fails.

I have preserved the ability, used in the regression tests, to
have a single select statement in what appears to be a RuleActionMulti
(but wasn't -- the parens were part of select_clause syntax).
In my version, this is a special form.

This may cause some discussion: I have differentiated the two kinds
of RuleActionMulti. Perhaps nobody knew there were two kinds, because
I don't think the second form appears in the regression tests. This
one uses square brackets instead of parentheses, but originally was
otherwise the same as the one in parentheses. In this version of
gram.y, the square bracket form treats SELECT statements the same
as the other allowed statements. As discussed before on this list,
psql cannot make sense out of the results of such a thing, but an
application might. And I have designs on just such an application.

++ kevin

--
Kevin O'Gorman (805) 650-6274 mailto:kogorman(at)pacbell(dot)net
Permanent e-mail forwarder: mailto:Kevin.O'Gorman(dot)64(at)Alum(dot)Dartmouth(dot)org
At school: mailto:kogorman(at)cs(dot)ucsb(dot)edu
Web: http://www.cs.ucsb.edu/~kogorman/index.html
Web: http://trixie.kosman.via.ayuda.com/~kevin/index.html

"There is a freedom lying beyond circumstance,
derived from the direct intuition that life can
be grounded upon its absorption in what is
changeless amid change"
-- Alfred North Whitehead

Attachment Content-Type Size
gram.diff text/plain 10.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-10-28 01:45:00 Second proposal: what to do about INET/CIDR
Previous Message Kevin O'Gorman 2000-10-28 00:58:23 Problem with installing as root