Re: After Upgrade from 8.2.6 to 8.3.6: function to_timestamp does not exist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nico Grubert <nicogrubert(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: After Upgrade from 8.2.6 to 8.3.6: function to_timestamp does not exist
Date: 2009-03-05 18:42:24
Message-ID: 8259.1236278544@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Nico Grubert <nicogrubert(at)gmail(dot)com> writes:
> SELECT a.*
> FROM tblevent a
> WHERE to_timestamp(a.from_datetime,'YYYY/MM/DD') >= to_timestamp(
> NOW(),'YYYY/MM/DD' )
> ORDER BY a.from_datetime

> In PostgreSQL 8.2.6 everything works fine.
> In PostgreSQL 8.3.6 I get the following error:
> ------------------------------------------------------------------------
> ERROR: function to_timestamp(timestamp without time zone, unknown) does
> not exist

This query makes little sense. Why are you trying to convert a
timestamp to a timestamp? Is this a bizarre substitute for date_trunc()?

The reason it "works" in 8.2 is that 8.2 will allow an implicit coercion
from timestamp to text --- although I put "work" in quotes because it
will not work too well if datestyle is anything but the default. You
could make it not-quite-work the same in 8.3 by adding an explicit
coercion of from_datetime to text, but I think you ought to read up on
date_trunc instead.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pat Maddox 2009-03-05 18:44:44 Re: Problem with SSL: "could not accept SSL connection: EOF detected"
Previous Message Tom Lane 2009-03-05 18:34:31 Re: Problem with SSL: "could not accept SSL connection: EOF detected"