David Fetter da...@fetter.org wrote:
On Mon, Aug 24, 2009 at 07:48:06PM -0400, Tom Lane wrote:
Kevin Grittner kevin.gritt...@wicourts.gov writes:
I realize I'm in a minority on this, but I would also prefer an
error. I expect things like
SELECT date + (INTERVAL '1' YEAR)
to just
David Fetter da...@fetter.org writes:
While debugging an error with Aziz (postgres_newbie) Sharief in the
#postgresql IRC channel, I found a major POLA violation:
I see no bug here. There is only one '+' operator with timestamptz
as left input, and it is timestamptz plus interval, so the
On Mon, Aug 24, 2009 at 09:12:07AM -0700, David Fetter wrote:
shac...@shackle:5432=# SELECT now() + '90';
?column?
---
2009-09-03 19:03:43.195514-07
(1 row)
shac...@shackle:5432=# SELECT now() - '90';
ERROR: date/time field
I wrote:
... I'm not sure why it's complaining about field overflow
rather than syntax error when the literal is taken as a timestamp,
but that's a pretty minor issue.
Oh, of course, it's because we allow this shorthand:
regression=# select '900102'::timestamptz;
timestamptz
On Mon, Aug 24, 2009 at 01:18:46PM -0400, Tom Lane wrote:
I wrote:
... I'm not sure why it's complaining about field overflow
rather than syntax error when the literal is taken as a timestamp,
but that's a pretty minor issue.
Oh, of course, it's because we allow this shorthand:
David Fetter da...@fetter.org writes:
On Mon, Aug 24, 2009 at 01:18:46PM -0400, Tom Lane wrote:
Just out of curiosity, what were you *expecting* this to do?
The gentleman in IRC was the one who was using the construct.
Well, what did he think it would do? If it's a date it's invalid,
and if
David Fetter da...@fetter.org writes:
He expected '-' to subtract seconds, just as '+' added them.
Ah. Well, what it boils down to is that in a scenario like
known_type_expr operator unknown_literal
we preferentially consider unknown_literal to be of the same type
as the other
On Mon, Aug 24, 2009 at 02:05:38PM -0400, Tom Lane wrote:
David Fetter da...@fetter.org writes:
On Mon, Aug 24, 2009 at 01:18:46PM -0400, Tom Lane wrote:
Just out of curiosity, what were you *expecting* this to do?
The gentleman in IRC was the one who was using the construct.
Well,
On Mon, Aug 24, 2009 at 02:31:35PM -0400, Tom Lane wrote:
David Fetter da...@fetter.org writes:
He expected '-' to subtract seconds, just as '+' added them.
Ah. Well, what it boils down to is that in a scenario like
known_type_expr operator unknown_literal
we preferentially
On Mon, Aug 24, 2009 at 8:27 PM, David Fetterda...@fetter.org wrote:
I'm thinking that the unknown literal here should just cause an error
in the case of '+'. Same with '-', for what it's worth.
That would make a lot of people very unhappy. They expect things like
select date + '1 year'
to
Greg Stark gsst...@mit.edu writes:
I wonder if we could get around this by inventing a new type
date_or_interval which looks at the input and decides which it is
using fairly strict rules. date_sub would take that type and do the
appropriate operation based on what the constant had in it.
On Mon, Aug 24, 2009 at 09:13:09PM +0100, Greg Stark wrote:
On Mon, Aug 24, 2009 at 8:27 PM, David Fetterda...@fetter.org wrote:
I'm thinking that the unknown literal here should just cause an
error in the case of '+'. Same with '-', for what it's worth.
That would make a lot of people
Greg Stark gsst...@mit.edu wrote:
David Fetterda...@fetter.org wrote:
I'm thinking that the unknown literal here should just cause an
error in the case of '+'. Same with '-', for what it's worth.
That would make a lot of people very unhappy. They expect things
like
select date + '1
Kevin Grittner kevin.gritt...@wicourts.gov writes:
I realize I'm in a minority on this, but I would also prefer an error.
I expect things like
SELECT date + (INTERVAL '1' YEAR)
to just work.
Uh, I think you're confused. That certainly works, and I didn't hear
anyone proposing to change
On Mon, Aug 24, 2009 at 07:48:06PM -0400, Tom Lane wrote:
Kevin Grittner kevin.gritt...@wicourts.gov writes:
I realize I'm in a minority on this, but I would also prefer an
error. I expect things like
SELECT date + (INTERVAL '1' YEAR)
to just work.
Uh, I think you're confused.
Tom,
we preferentially consider unknown_literal to be of the same type
as the other operand.
I can't really think of what other assumption we would make. Any time a
user doesn't specify a type, they're taking pot luck.
Me, I always use some_timestamp + INTERVAL 'value'
--
Josh Berkus
16 matches
Mail list logo