Re: [HACKERS] subquery syntax broken

From: "Vadim B(dot) Mikheev" <vadim(at)sable(dot)krasnoyarsk(dot)su>
To: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
Cc: hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] subquery syntax broken
Date: 1998-02-03 02:50:17
Message-ID: 34D685E9.D719AFF2@sable.krasnoyarsk.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian wrote:
>
> > 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.

It doesn't work for =, >, etc:

vac=> select * from x where y = (select max(y) from x);
ERROR: parser: parse error at or near "select"

but work for others:

vac=> select * from x where y @ (select max(y) from x);
ERROR: There is no operator '@' for types 'int4' and 'int4'
You will either have to retype this query using an explicit cast,
or you will have to define the operator using CREATE OPERATOR

Also:

> + | 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;
^^^^^^^^^^^
should be EXPR_SUBLINK
> + n->subselect = $4;
> + $$ = (Node *)n;
> + }

Vadim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-02-03 03:17:41 Re: [HACKERS] subquery syntax broken
Previous Message The Hermit Hacker 1998-02-03 02:06:30 Re: compilation on sparc_solaris