Re: [BUGS] Failure to coerce unknown type to specific type

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql(at)j-davis(dot)com
Cc: david(dot)g(dot)johnston(at)gmail(dot)com, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] Failure to coerce unknown type to specific type
Date: 2015-04-23 08:18:08
Message-ID: 20150423.171808.150348710.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Sorry, the patch had obvious bug..

-+ Int32GetDatum(inputTypeMod),
++ Int32GetDatum(targetTypeMod),

regards,

> Hello, I think this is a bug.
>
> The core of this problem is that coerce_type() fails for Var of
> type UNKNOWNOID.
>
> The comment for the function says that,
>
> > * The caller should already have determined that the coercion is possible;
> > * see can_coerce_type.
>
> But can_coerce_type() should say it's possible to convert from
> unknown to any type as it doesn't see the target node type. I
> think this as an inconsistency between can_coerce_type and
> coerce_type. So making this consistent would be right way.
>
> Concerning only this issue, putting on-the-fly conversion for
> unkown nonconstant as attached patch worked for me. I'm not so
> confident on this, though..
>
> regards,
>
> At Wed, 22 Apr 2015 23:26:43 -0700, Jeff Davis <pgsql(at)j-davis(dot)com> wrote in <1429770403(dot)4604(dot)22(dot)camel(at)jeff-desktop>
> > On Wed, 2015-04-22 at 20:35 -0700, David G. Johnston wrote:
> >
> > > But the fact that column "b" has the data type "unknown" is only a
> > > warning - not an error.
> > >
> > I get an error:
> >
> > postgres=# SELECT ' '::text = 'a';
> > ?column?
> > ----------
> > f
> > (1 row)
> >
> > postgres=# SELECT a=b FROM (SELECT ''::text, ' ') x(a,b);
> > ERROR: failed to find conversion function from unknown to text

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
var_coerce-2.patch text/x-patch 1.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2015-04-23 08:31:44 Re: [BUGS] Failure to coerce unknown type to specific type
Previous Message Kyotaro HORIGUCHI 2015-04-23 08:07:10 Re: [BUGS] Failure to coerce unknown type to specific type

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2015-04-23 08:19:06 Re: Freeze avoidance of very large table.
Previous Message Heikki Linnakangas 2015-04-23 08:11:19 Re: Streaming replication and WAL archive interactions