On 14/04/11 17:05, Kevin Grittner wrote:
SELECT 1,null,null FROM DUAL
UNION
SELECT 2,3,null FROM DUAL
UNION
SELECT 3,null,4 FROM DUAL
Sadly I can't profess to knowing Oracle, however if I run the query as
suggested I get:
--------------------
1 | NULL | NULL
--------------------
1 | <null> | <null>
2 | 3 | <null>
3 | <null> | 4
So to summarise, Oracle and PostgreSQL need minor tweaks to run cleanly
and SQLServer and MySQL do not. Given that the change for PostgreSQL is
so minor, I vote for changing the error message as Jeff suggests in the
interim to help users while the standards argument continues. Patch
attached.
Regards,
--
Mike Fowler
Registered Linux user: 379787
*** a/src/backend/parser/parse_coerce.c
--- b/src/backend/parser/parse_coerce.c
***************
*** 1161,1167 **** select_common_type(ParseState *pstate, List *exprs, const char *context,
(errcode(ERRCODE_DATATYPE_MISMATCH),
/*------
translator: first %s is name of a SQL construct, eg CASE */
! errmsg("%s types %s and %s cannot be matched",
context,
format_type_be(ptype),
format_type_be(ntype)),
--- 1161,1167 ----
(errcode(ERRCODE_DATATYPE_MISMATCH),
/*------
translator: first %s is name of a SQL construct, eg CASE */
! errmsg("%s types %s and %s cannot be matched. HINT: Postgres casts unknown types to TEXT by default.",
context,
format_type_be(ptype),
format_type_be(ntype)),
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs