Re: inserting a NULL timestamp

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: inserting a NULL timestamp
Date: 2011-03-29 17:09:54
Message-ID: 4D921262.9070508@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 03/29/2011 10:03 AM, Robert Poor wrote:
> .
>
> # INSERT INTO service_bills (cost,start_time)
> SELECT candidates.*
> FROM (SELECT 2.3 AS cost, NULL AS start_time) AS candidates;
>
> This, though, raises an error:
>
> # ERROR: failed to find conversion function from unknown to timestamp
> without time zone
>
> So: What's so different about the second version?

It's the select part that is causing your trouble. Try casting the null
to a timestamp:
...as cost, null::timestamp as start_time...

Cheers,
Steve

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Robert Poor 2011-03-29 17:18:17 Re: inserting a NULL timestamp
Previous Message Robert Poor 2011-03-29 17:03:30 inserting a NULL timestamp