pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: ilejn@yandex.ru
Cc: dev@archonet.com
Cc: pgsql-general@postgresql.org
Subject: Re: Old question - failed to find conversion function from "unknown"
Date: Tue, 19 Jul 2005 10:17:35 -0400
Message-ID: <23591.1121782655@sss.pgh.pa.us> (raw)
In-Reply-To: <42DCEFEE.000005.12199@mfront8.yandex.ru>
References: <42DCC1E9.2060300@aeccom.com>
	<42DCCCCE.000006.04382@mfront8.yandex.ru>
	<42DCDE07.4020906@archonet.com>
	<42DCEFEE.000005.12199@mfront8.yandex.ru>

"Ilja Golshtein" <ilejn@yandex.ru> writes:
>> Well, it would obviously be better if PG could figure out it was safe, 
>> but I'm not sure there's a general case where it is. You can see it's OK 
>> because you know there's only one row in your SELECT result-set. 

> I think, it's OK because NULL can be compared with anything 
> with predictable result and no additional information about 
> types is necessary.
> Is it correct vision?

The backend doesn't really distinguish NULL from 'foo' (or untyped
string literals in general) when making datatype decisions.  If we
were to change the behavior of 
	select 1 where 5 in (select null)
at all, it would undoubtedly be to treat it as
	select 1 where 5 in (select null::text)
because TEXT is the default resolution for UNKNOWN in every other
case where we force a choice to be made.  But this is not what you
want for your example, and in general it would probably break as
many cases as it fixed.  So I'm inclined to leave it as-is ---
an error message is probably better than a surprising silent choice.

My recommendation is to cast the NULL to the right type explicitly.

			regards, tom lane



view thread (8+ messages)  latest in thread

Message-ID: <23591.1121782655@sss.pgh.pa.us>
Permalink:  ../23591.1121782655@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23591.1121782655@sss.pgh.pa.us

 · 

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 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-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ilejn@yandex.ru, dev@archonet.com, pgsql-general@postgresql.org
  Subject: Re: Old question - failed to find conversion function from "unknown"
  In-Reply-To: <23591.1121782655@sss.pgh.pa.us>
  References: <42DCC1E9.2060300@aeccom.com> <42DCCCCE.000006.04382@mfront8.yandex.ru> <42DCDE07.4020906@archonet.com> <42DCEFEE.000005.12199@mfront8.yandex.ru> <23591.1121782655@sss.pgh.pa.us>

* 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