pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedFrom: Adrian Klaver <adrian.klaver@aklaver.com>
To: Michael Moore <michaeljmoore@gmail.com>
To: postgres list <pgsql-sql@postgresql.org>
Subject: Re: weird error message
Date: Fri, 6 May 2016 06:53:23 -0700
Message-ID: <e9b9f162-ad10-74a8-9f5a-3198b2a36144@aklaver.com> (raw)
In-Reply-To: <CACpWLjMK8J2O_zjrhBgfYoYU=eO=+CNO7DE0BNM6YNTkbYV4Hw@mail.gmail.com>
References: <CACpWLjMK8J2O_zjrhBgfYoYU=eO=+CNO7DE0BNM6YNTkbYV4Hw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
On 05/05/2016 01:14 PM, Michael Moore wrote:
> SELECT COALESCE(dt, i) FROM (SELECT null AS dt, null AS i) q;
> gives
> ERROR: failed to find conversion function from unknown to text
> ********** Error **********
>
> ERROR: failed to find conversion function from unknown to text
> SQL state: XX000
>
> So, I understand the datatype of 'null' is 'unknown', but what does
> 'text' have to do with it?
Hmm:
hplc=> SELECT null AS dt, null AS i;
dt | i
----+---
|
(1 row)
hplc=> select null::text as dt, null::text as i;
dt | i
----+---
|
(1 row)
hplc=> SELECT COALESCE(dt, i) FROM (SELECT null::text AS dt,
null::text AS i) q;
coalesce
----------
(1 row)
hplc=> SELECT COALESCE(dt, i) FROM (SELECT null AS dt, null AS i) q;
ERROR: failed to find conversion function from unknown to text
So it is not the conversion from NULL to text per se, just when it is
done on the output of a derived table. I don't why that is, maybe
someone else can chime in.
>
> Mike
>
--
Adrian Klaver
adrian.klaver@aklaver.com
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (9+ messages) latest in thread
Message-ID: <e9b9f162-ad10-74a8-9f5a-3198b2a36144@aklaver.com>
Permalink: ../e9b9f162-ad10-74a8-9f5a-3198b2a36144@aklaver.com/
Also on: postgresql.org/message-id/e9b9f162-ad10-74a8-9f5a-3198b2a36144@aklaver.com
reply
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: adrian.klaver@aklaver.com, michaeljmoore@gmail.com
Subject: Re: weird error message
In-Reply-To: <e9b9f162-ad10-74a8-9f5a-3198b2a36144@aklaver.com>
* 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