From: | Mike Mascari <mascarm(at)mascari(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Oddity with literal intervals |
Date: | 2004-03-18 19:02:31 |
Message-ID: | 4059F247.5090301@mascari.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane wrote:
> 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.
Okay. That's why I posted it to -general and not -bugs, because I
suspected there was some reason behind it. I guess it seemed odd
because it has been on rare occasion that I have encountered types
where there exists a '-' operator without a corresponding '+'
operator. And, coincidentally having a '+' operator available for
timestampz + interval just added to my confusion. But the above
makes perfect sense.
Thanks!
Mike Mascari
From | Date | Subject | |
---|---|---|---|
Next Message | CoL | 2004-03-18 20:46:30 | Re: delete using limit |
Previous Message | Tom Lane | 2004-03-18 18:38:49 | Re: Oddity with literal intervals |