From: Jeff Davis <pgsql@j-davis.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Postgres-Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Failure to coerce unknown type to specific type
Date: Sat, 02 May 2015 14:55:56 -0700
Message-ID: <1430603756.2499.44.camel@jeff-desktop> (raw)
In-Reply-To: <37798.1430500134@sss.pgh.pa.us>
References: <CAMp0ubdECGUJWpQKyUM36PxQWoKe0VfTbHGHgn+w2H_5q1Nmow@mail.gmail.com>
<1430.1428543112@sss.pgh.pa.us>
<CA+Tgmoav4gswNkA39SYdb3SdSBfrcHmU08=nXLNbxMZFg7UYsw@mail.gmail.com>
<35651.1430347071@sss.pgh.pa.us>
<1430459450.2499.17.camel@jeff-desktop>
<CA+TgmoaUNFTvUnmV3Fj+kK-TyjVN_S0zNSD_hMBYP8kMCo1d3g@mail.gmail.com>
<37798.1430500134@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On Fri, 2015-05-01 at 10:08 -0700, Tom Lane wrote:
> What really ought to happen here, IMO, is that the output columns of the
> sub-select ought to get resolved to non-unknown types while we are doing
> parse analysis of the sub-select.
So, what would happen for something like:
select u+i from (select '1' as u, '2'::int as i) s;
?
I can see two possibilities:
1. Resolve "u" from the subselect as text, and later fail to find a
match for +(text,int).
2. Resolve +(unknown, int) to +(int, int) first, then inform the
subselect that it's looking for an int (in the same way that you propose
the insert pass down some context).
I don't think the second one really makes sense though. For example:
select u+i, u||'suffix'::text from (select '1' as u, '2'::int as i) s;
In that case, "+" would be resolved to +(int, int) and || would be
resolved to ||(text, text). But "u" from the subselect can't be both an
int and text.
Then again, we probably want to fail a query like that anyway. So maybe
it does make sense as long as we can figure out a single type for "u",
and we fail otherwise.
Regards,
Jeff Davis
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: pgsql@j-davis.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com
Subject: Re: Failure to coerce unknown type to specific type
In-Reply-To: <1430603756.2499.44.camel@jeff-desktop>
References: <CAMp0ubdECGUJWpQKyUM36PxQWoKe0VfTbHGHgn+w2H_5q1Nmow@mail.gmail.com> <1430.1428543112@sss.pgh.pa.us> <CA+Tgmoav4gswNkA39SYdb3SdSBfrcHmU08=nXLNbxMZFg7UYsw@mail.gmail.com> <35651.1430347071@sss.pgh.pa.us> <1430459450.2499.17.camel@jeff-desktop> <CA+TgmoaUNFTvUnmV3Fj+kK-TyjVN_S0zNSD_hMBYP8kMCo1d3g@mail.gmail.com> <37798.1430500134@sss.pgh.pa.us> <1430603756.2499.44.camel@jeff-desktop>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox