Re: [HACKERS] subquery syntax broken - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] subquery syntax broken
Date
Msg-id 199802021700.MAA12855@candle.pha.pa.us
Whole thread Raw
In response to subquery syntax broken  ("Vadim B. Mikheev" <vadim@sable.krasnoyarsk.su>)
List pgsql-hackers
> vac=> select * from x where y = (select max(y) from x);
> ERROR:  parser: parse error at or near "select"
> vac=> select * from x where y <> (select max(y) from x);
> ERROR:  parser: parse error at or near "select"

Sorry I missed that most obvious option.  Here is the patch.  I will
apply it today.

---------------------------------------------------------------------------

*** ./backend/parser/gram.y.orig    Mon Feb  2 11:51:05 1998
--- ./backend/parser/gram.y    Mon Feb  2 11:59:12 1998
***************
*** 3330,3335 ****
--- 3330,3345 ----
                      n->subselect = $5;
                      $$ = (Node *)n;
                  }
+         | a_expr Op '(' SubSelect ')'
+                 {
+                     SubLink *n = makeNode(SubLink);
+                     n->lefthand = lcons($1, NULL);
+                     n->oper = lcons($2,NIL);
+                     n->useor = false;
+                     n->subLinkType = ALL_SUBLINK;
+                     n->subselect = $4;
+                     $$ = (Node *)n;
+                 }
          | a_expr AND a_expr
                  {    $$ = makeA_Expr(AND, NULL, $1, $3); }
          | a_expr OR a_expr

--
Bruce Momjian
maillist@candle.pha.pa.us

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Variable block size...
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] subquery syntax broken