Re: (PATCH) Adding CORRESPONDING (NULL error)

From: Kerem Kat <keremkat(at)gmail(dot)com>
To: Erik Rijkers <er(at)xs4all(dot)nl>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: (PATCH) Adding CORRESPONDING (NULL error)
Date: 2011-10-27 19:21:41
Message-ID: CAJZSWkVJ2Rr9BFDj77EHUOo9CYpDj=rJ7dtrF5i7V+g7q2CwEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Union with NULL error persists without the corresponding patch. Here
is the output from postgres without the patch:

SELECT a FROM (SELECT 1 a) foo
UNION
SELECT a FROM (SELECT NULL a) foo2;

ERROR: failed to find conversion function from unknown to integer

It is thrown from parse_coerce.c:coerce_type method. I will try to dig
deep on it.

Regards,

Kerem KAT

On Thu, Oct 27, 2011 at 15:45, Erik Rijkers <er(at)xs4all(dot)nl> wrote:
> (pgsql 9.2devel (25 oct) with your latest CORRESPONDING patch;
> linux x86_64 GNU/Linux 2.6.18-274.3.1.el5)
>
> Hi,
>
> here is another peculiarity, which I think is a bug:
>
> -- first without CORRESPONDING:
>
> $ psql -Xaf null.sql
>            select 1 a   , 2 b
> union all
>            select null a, 4 b ;
>  a | b
> ---+---
>  1 | 2
>   | 4
> (2 rows)
>
> -- then with CORRESPONDING:
>
>            select 1 a   , 2 b
> union all
> corresponding
>            select null a, 4 b ;
> psql:null.sql:9: ERROR:  failed to find conversion function from unknown to integer
>
>
> If the null value is in a table column the error does not occur:
>
> drop table if exists t1; create table t1 (a int, b int); insert into t1 values (1,2);
> drop table if exists t2; create table t2 (a int, b int); insert into t2 values (null,2);
>                select a,b from t1
> union all
> corresponding
>                select a,b from t2 ;
>  a | b
> ---+---
>  1 | 2
>   | 2
> (2 rows)
>
>
> I'm not sure it is actually a bug; but it seems an unneccessary error.
>
>
> thanks,
>
> Erik Rijkers
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Florian Pflug 2011-10-27 19:23:16 Re: Hot Backup with rsync fails at pg_clog if under load
Previous Message Kevin Grittner 2011-10-27 19:14:10 Re: out-of-order caution