Skip site navigation (1) Skip section navigation (2)

Re: Interval constant syntax, was Re: Interval & check clause

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Karl O(dot) Pinc" <kop(at)meme(dot)com>
Cc: Bruno BAGUETTE <pgsql-ml(at)baguette(dot)net>,pgsql-general(at)postgresql(dot)org
Subject: Re: Interval constant syntax, was Re: Interval & check clause
Date: 2004-03-30 05:22:36
Message-ID: 20040330052236.GA14444@wolff.to (view raw or flat)
Thread:
Lists: pgsql-general
On Mon, Mar 29, 2004 at 15:28:59 -0600,
  "Karl O. Pinc" <kop(at)meme(dot)com> wrote:
> 
> And this was my scratch psql test:
> 
> => select CAST('1/1/2004' AS date) - '3 years';
> ERROR:  Bad date external representation '3 years'
> 
> I am using 7.3 so maybe this has been fixed.  Or it's just the
> operator, some require casts and some don't and you just have to find
> out the hard way.  :(

This is different in that you are using - instead of >= . Date - Date
will get picked because that is the only - operator with a left operand
of type date. You are trying to use timestamp - interval (with date
getting promoted to timestamp).

In response to

Responses

pgsql-general by date

Next:From: Tom LaneDate: 2004-03-30 05:42:28
Subject: Re: Interval constant syntax, was Re: Interval & check clause
Previous:From: Andrew RawnsleyDate: 2004-03-30 04:08:25
Subject: Re: PG vs MySQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group