Re: pgsql do not handle NULL constants in the view

From: Sergey Hripchenko <shripchenko(at)intermedia(dot)net>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: pgsql do not handle NULL constants in the view
Date: 2008-08-20 13:49:00
Message-ID: 99EB298E5D3A2C46BD744630B3FD093E9515D6054B@EXVMBX-1.intermedia-inc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thx it helps.

Shame on me %) I forgot that NULL itself has no type, and thought that each constant in the view are casted to the resulting type at the creation time.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Wednesday, August 20, 2008 4:54 PM
To: Sergey Hripchenko
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] pgsql do not handle NULL constants in the view

Sergey Hripchenko <shripchenko(at)intermedia(dot)net> writes:
> CREATE OR REPLACE VIEW bar AS
> SELECT *
> FROM (
> (
> SELECT calldate, duration, billsec, get_asterisk_cdr_caller_id(accountcode) AS caller_id
> FROM asterisk_cdr
> ) UNION ALL (
> SELECT start_time, get_interval_seconds(completed_time-start_time), get_interval_seconds(answered_time-start_time), NULL
> FROM asterisk_huntgroups_calls
> )
> ) AS foo;

Try casting the NULL to integer (or whatever the datatype of the other
union arm is) explicitly.

regards, tom lane

This message (including attachments) is private and confidential. If you have received this message in error, please notify us and remove it from your system.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Mark Lewis 2008-08-20 14:40:13 Re: PostgreSQL+Hibernate Performance
Previous Message Tom Lane 2008-08-20 12:54:24 Re: pgsql do not handle NULL constants in the view