Re: [BUGS] Failure to coerce unknown type to specific type - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: [BUGS] Failure to coerce unknown type to specific type
Date
Msg-id 20150423.192043.05311305.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: [BUGS] Failure to coerce unknown type to specific type  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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

pgsql-hackers by date:

Previous
From: Sandeep Thakkar
Date:
Subject: anole - test case sha2 fails on all branches
Next
From: Andres Freund
Date:
Subject: Re: INSERT ... ON CONFLICT IGNORE (and UPDATE) 3.0