BUG #4275: Multicolumn subquery expression not allowed on both sides of IS DISTINCT FROM

Lists: pgsql-bugs
From: "Carl-Daniel Hailfinger" <c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4275: Multicolumn subquery expression not allowed on both sides of IS DISTINCT FROM
Date: 2008-07-01 02:47:45
Message-ID: 200807010247.m612ljXC053427@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4275
Logged by: Carl-Daniel Hailfinger
Email address: c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net
PostgreSQL version: 8.2.9
Operating system: openSUSE Linux 10.3, x86
Description: Multicolumn subquery expression not allowed on both
sides of IS DISTINCT FROM
Details:

The PostgreSQL docs say a multicolumn subquery expression is not allowed on
both sides of IS DISTINCT FROM. The implementation conforms to the docs, but
AFAICS the SQL:2003 standard allows multicolumn subquery expressions on both
sides of the operator.

This works:
# SELECT ROW(true,true)=(SELECT true,true);

This doesn't:
# SELECT (SELECT true,true)=(SELECT true,true);
Error: 42601: subquery must return only one column
Location: transformSubLink, parse_expr.c:1139

Expected result:
The second query has the same result as the first query (true).

Please allow me to explain why I think the standard allows multicolumn
subqueries on both sides of IS DISTINCT FROM:

<distinct predicate> ::= <row value predicand 3> <distinct predicate
part 2>

<distinct predicate part 2> ::= IS DISTINCT FROM <row value predicand
4>

<row value predicand 3> ::= <row value predicand>

<row value predicand 4> ::= <row value predicand>

<row value predicand> ::=
<row value special case>
| <row value constructor predicand>

<row value constructor predicand> ::=
<common value expression>
| <boolean predicand>
| <explicit row value constructor>

<explicit row value constructor> ::=
<left paren> <row value constructor element> <comma> <row value
constructor element list> <right paren>
| ROW <left paren> <row value constructor element list> <right
paren>
| <row subquery>

So the following should be valid:
<distinct predicate> ::= <row subquery> IS DISTINCT FROM <row
subquery>

Somebody in the #postgresql irc channel was so kind to test this on 8.3.3
with the same results.

Regards,
Carl-Daniel


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Carl-Daniel Hailfinger" <c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4275: Multicolumn subquery expression not allowed on both sides of IS DISTINCT FROM
Date: 2008-07-01 14:32:36
Message-ID: 3563.1214922756@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Carl-Daniel Hailfinger" <c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net> writes:
> This works:
> # SELECT ROW(true,true)=(SELECT true,true);

> This doesn't:
> # SELECT (SELECT true,true)=(SELECT true,true);
> Error: 42601: subquery must return only one column

This is not a bug, since we do not claim support for feature F641.

regards, tom lane


From: Carl-Daniel Hailfinger <c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4275: Multicolumn subquery expression not allowed on both sides of IS DISTINCT FROM
Date: 2008-07-02 17:51:19
Message-ID: 486BC017.2080609@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On 01.07.2008 16:32, Tom Lane wrote:
> "Carl-Daniel Hailfinger" <c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net> writes:
>
>> This works:
>> # SELECT ROW(true,true)=(SELECT true,true);
>>
>
>
>> This doesn't:
>> # SELECT (SELECT true,true)=(SELECT true,true);
>> Error: 42601: subquery must return only one column
>>
>
> This is not a bug, since we do not claim support for feature F641.
>

Thanks for the information. Is there any plan to support that feature in
8.4?

Regards,
Carl-Daniel


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Carl-Daniel Hailfinger <c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4275: Multicolumn subquery expression not allowed on both sides of IS DISTINCT FROM
Date: 2008-07-03 00:28:21
Message-ID: 19009.1215044901@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Carl-Daniel Hailfinger <c-d(dot)hailfinger(dot)devel(dot)2006(at)gmx(dot)net> writes:
> On 01.07.2008 16:32, Tom Lane wrote:
>> This is not a bug, since we do not claim support for feature F641.

> Thanks for the information. Is there any plan to support that feature in
> 8.4?

I don't know of anyone working on it at the moment.

regards, tom lane