Re: pgsql do not handle NULL constants in the view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sergey Hripchenko <shripchenko(at)intermedia(dot)net>
Cc: "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 12:54:24
Message-ID: 27257.1219236864@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Sergey Hripchenko 2008-08-20 13:49:00 Re: pgsql do not handle NULL constants in the view
Previous Message Kranti K K Parisa™ 2008-08-20 12:25:16 PostgreSQL+Hibernate Performance