pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #11266: failed to find conversion function from unknown to bigint
2+ messages / 2 participants
[nested] [flat]
* BUG #11266: failed to find conversion function from unknown to bigint
@ 2014-08-26 06:21 zoulx1982@163.com
2014-08-26 14:42 ` Re: BUG #11266: failed to find conversion function from unknown to bigint Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: zoulx1982@163.com @ 2014-08-26 06:21 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 11266
Logged by: zoulx1982
Email address: zoulx1982@163.com
PostgreSQL version: 9.4beta2
Operating system: Win7
Description:
when i migrate my application from oracle to postgrs,
i encounter a query raise error "failed to find conversion function from
unknown to bigint"
the original query is very complicated, so i summarize a simple testcase:
create table t1(a varchar(10));
create table t2(x varchar(10), y bigint);
select s.*
from
(select a, null b from t1
group by a
) s
union all
select x,y from t2;--ERROR
postgres=# select version();
version
----------------------------------------------------------------
PostgreSQL 9.5devel, compiled by Visual C++ build 1600, 32-bit
(1 row)
and when i remove the "group" clause, the query works well
or if i don't use sub-query, it can also work well, i.e.
select a, null b from t1 group by a union all select x,y from t2;
and
select s.* from (select a, null b from t1) s union all select x,y from t2;
is all OK.
is there parameters to avoid the issue without changing original sql,
or doe's somebody can fix the issue later ?
thanks.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #11266: failed to find conversion function from unknown to bigint
2014-08-26 06:21 BUG #11266: failed to find conversion function from unknown to bigint zoulx1982@163.com
@ 2014-08-26 14:42 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2014-08-26 14:42 UTC (permalink / raw)
To: zoulx1982@163.com; +Cc: pgsql-bugs
zoulx1982@163.com writes:
> select s.*
> from
> (select a, null b from t1
> group by a
> ) s
> union all
> select x,y from t2;--ERROR
> is there parameters to avoid the issue without changing original sql,
> or doe's somebody can fix the issue later ?
No, and no. You need to cast the NULL literal to some specific datatype
(in this example, you want the type of t2.y).
A bare NULL like this is illegal per SQL standard; you're always supposed
to cast it, or else write it in a place like an INSERT list where the
null's type can be inferred from immediate context. Most real DBMSes
allow you to violate that rule to some extent, but you should not be
surprised that the exact places where you can get away with it vary from
product to product. Postgres is not exactly like Oracle in this respect,
and we're unlikely to try to make it so.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2014-08-26 14:42 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-08-26 06:21 BUG #11266: failed to find conversion function from unknown to bigint zoulx1982@163.com
2014-08-26 14:42 ` Tom Lane <tgl@sss.pgh.pa.us>
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