| From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
|---|---|
| To: | Ludwig Lim <lud_nowhere_man(at)yahoo(dot)com> |
| Cc: | PostgreSQL Mailing List <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: Weird NULL behavior |
| Date: | 2002-11-07 16:41:26 |
| Message-ID: | 20021107083423.A97075-100000@megazone23.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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));
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Rison, Stuart | 2002-11-07 16:51:37 | Re: Copying a rowtype variable. |
| Previous Message | Achilleus Mantzios | 2002-11-07 16:38:06 | Re: [SQL] Problem: Referential Integrity Constraints lost |