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: david(dot)g(dot)johnston(at)gmail(dot)com
Cc: pgsql(at)j-davis(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 10:20:43
Message-ID: 20150423.192043.05311305.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hello,

> > 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.
> >
> >
> You have two pieces of contradictory knowledge - how are you picking which
> one to "fix"?

What do you think are contradicting? The patch fixes the problem
that unkown nonconstats cannot get proper conversion and the
query fails.

| SELECT a=b FROM (SELECT ''::text, ' ') x(a,b);
| ERROR: failed to find conversion function from unknown to text

> > 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..
> >
>
> Confident about what aspect - the safety of the patch itself or whether
> the conversion is even a good idea?​

Mainly the former, and how far it covers the other similar but
unkown troubles, generality? in other words.

The fix would not so significant but no processing cost or
complexity added, and would reduce astonishment if it works
safely.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2015-04-23 17:18:32 Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)
Previous Message Kyotaro HORIGUCHI 2015-04-23 10:07:49 Re: [BUGS] Failure to coerce unknown type to specific type

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-04-23 10:54:07 Re: INSERT ... ON CONFLICT IGNORE (and UPDATE) 3.0
Previous Message Sandeep Thakkar 2015-04-23 10:13:07 anole - test case sha2 fails on all branches