Re: [HACKERS] Re: subselects

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: vadim(at)sable(dot)krasnoyarsk(dot)su (Vadim B(dot) Mikheev)
Cc: lockhart(at)alumni(dot)caltech(dot)edu, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Re: subselects
Date: 1998-01-12 13:58:25
Message-ID: 199801121359.IAA01854@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Thomas G. Lockhart wrote:
> >
> > btw, to implement "(a,b,c) OP (d,e,f)" I made a new routine in the parser called
> > makeRowExpr() which breaks this up into a sequence of "and" and/or "or" expressions.
> > If lists are handled farther back, this routine should move to there also and the
> > parser will just pass the lists. Note that some assumptions have to be made about the
> > meaning of "(a,b) OP (c,d)", since usually we only have knowledge of the behavior of
> > "a OP c". Easy for the standard SQL operators, unknown for others, but maybe it is OK
> > to disallow those cases or to look for specific appearance of the operator to guess
> > the behavior (e.g. if the operator has "<" or "=" or ">" then build as "and"s and if
> > it has "<>" or "!" then build as "or"s.
>
> Oh, god! I never thought about this!
> Ok, I have to agree:
>
> 1. Only <, <=, =, >, >=, <> is allowed with subselects
> 2. Use OR's for <>, and so - we need in bool useor in SubLink
> for <>, <> ANY and <> ALL:

Ah, but this is just a problem when there are multiple fields on the
left.

>
> typedef struct SubLink {
> NodeTag type;
> int linkType; /* EXISTS, ALL, ANY, EXPR */
> bool useor; /* TRUE for <> */
> List *lefthand; /* List of Var/Const nodes on the left */
> List *oper; /* List of Oper nodes */
> Query *subquery; /* */
> } SubLink;

--
Bruce Momjian
maillist(at)candle(dot)pha(dot)pa(dot)us

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-01-12 14:23:49 Re: [HACKERS] Re: subselects
Previous Message Thomas G. Lockhart 1998-01-12 13:41:31 Re: [HACKERS] Re: subselects