Re: [HACKERS] [6.5.2] join problems ...

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: [HACKERS] [6.5.2] join problems ...
Дата
Msg-id 37E4F937.D2345321@alumni.caltech.edu
обсуждение исходный текст
Ответ на Re: [HACKERS] [6.5.2] join problems ...  (The Hermit Hacker <scrappy@hub.org>)
Список pgsql-hackers
<snip>
> > AND (a.id,a.mid = b.id,b.mid)
> > AND (b.catid,b.indid,b.divid = c.id,c.ppid,c.pid);
> ... the above is not valid in PostgreSQL, it seems...

I have to resort to looking at gram.y for this, since I currently have
the Postgres parser in bits and pieces all over the garage floor ;)

The expressions are *almost* valid for Postgres. The difference is
that you need to put parens around each side of the "row expression":
       | '(' row_descriptor ')' row_op '(' row_descriptor ')'               {                   $$ = makeRowExpr($4,
$2,$6);               }       ;
 

I had implemented this using Date and Darwen as a reference, and afaik
the SQL standard (and any sensible parser) *requires* parens around
the row expression, referred to in gram.y as a "row descriptor".

So, the following should work:
 AND ((a.id,a.mid) = (b.id,b.mid)) AND ((b.catid,b.indid,b.divid) = (c.id,c.ppid,c.pid));

                   - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


В списке pgsql-hackers по дате отправления:

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: All things equal, we are still alot slower then MySQL?
Следующее
От: "Brett W. McCoy"
Дата:
Сообщение: Re: [INTERFACES] PERL