From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Ludwig Lim <lud_nowhere_man@yahoo.com>
Cc: PostgreSQL Mailing List <pgsql-sql@postgresql.org>
Subject: Re: Weird NULL behavior
Date: Thu, 7 Nov 2002 08:41:26 -0800 (PST)
Message-ID: <20021107083423.A97075-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <20021107114103.43007.qmail@web80306.mail.yahoo.com>
On Thu, 7 Nov 2002, Ludwig Lim wrote:
> Hi:
>
> Has anyone encountered this before?
> SELECT CAST ( (NULL*NULL) AS NUMERIC(2,0));
>
>
> returns the following error message:
> Cannot cast type '"char"' to '"numeric"'
It seems to me that it's trying to decide on a type
for the expression NULL * NULL. It's a NULL, but a
NULL of what type? I think the spec gets around
this by disallowing such structures AFAIK (NULL
can be used in like row value constructors, case
and cast). I think the "sql" way of doing the
above would be
select cast(cast(NULL as NUMERIC(2,0))*cast(NULL as NUMERIC(2,0))
as NUMERIC(2,0));
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: sszabo@megazone23.bigpanda.com, lud_nowhere_man@yahoo.com
Subject: Re: Weird NULL behavior
In-Reply-To: <20021107083423.A97075-100000@megazone23.bigpanda.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