Re: Oddity with literal intervals

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Oddity with literal intervals
Date: 2004-03-18 18:38:49
Message-ID: 10987.1079635129@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Mike Mascari <mascarm(at)mascari(dot)com> writes:
> Here's something odd I stumbled upon:

> [estore(at)lexus] select now() - '1 day';
> ERROR: invalid input syntax for type timestamp with time zone: "1 day"

What's odd about it? The preferred interpretation is timestamptz minus
another timestamptz (yielding an interval). If you want timestamptz
minus interval (yielding timestamptz), you have to do something to cue
the system that the literal should be taken as an interval.

The "+" cases work because there is no timestamp plus timestamp operator.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2004-03-18 19:02:31 Re: Oddity with literal intervals
Previous Message Ericson Smith 2004-03-18 18:26:59 Re: Opteron build process question