'current' timestamp bug

Started by Joseph Shraibmanalmost 25 years ago4 messagesgeneral
Jump to latest
#1Joseph Shraibman
jks@selectacast.net

It seems some input validation isn't working somewhere.

Unless I'm missing something and somehow 'current' is a magic timestamp
value (in which case the jdbc driver should be able to parse it
somehow).

playpen=# update tablea set ts = current_timestamp where id = 1;
UPDATE 1
playpen=# select * from tablea;
id | ts
----+------------------------
1 | 2001-05-07 16:32:55-04
(1 row)

playpen=# update tablea set ts = 'current_timestamp' where id = 1;
UPDATE 1
playpen=# select * from tablea;
id | ts
----+---------
1 | current
(1 row)

playpen=# update tablea set ts = 'foo' where id = 1;
ERROR: Bad timestamp external representation 'foo'
playpen=# update tablea set ts = 'current_foo' where id = 1;
UPDATE 1
playpen=# select * from tablea;
id | ts
----+---------
1 | current
(1 row)

playpen=# update tablea set ts = 'xxxxxxxfoo' where id = 1;
ERROR: Bad timestamp external representation 'xxxxxxxfoo'

--
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio. http://www.targabot.com

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Joseph Shraibman (#1)
Re: 'current' timestamp bug

Joseph Shraibman writes:

Unless I'm missing something and somehow 'current' is a magic timestamp
value

You are missing something.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter

#3Joseph Shraibman
jks@selectacast.net
In reply to: Peter Eisentraut (#2)
Re: 'current' timestamp bug

Peter Eisentraut wrote:

Joseph Shraibman writes:

Unless I'm missing something and somehow 'current' is a magic timestamp
value

You are missing something.

If you are referring to
http://www.ca.postgresql.org/docs/postgres/datatype-datetime.html#AEN3223
It doesn't indicate that 'current_timestamp' is the same as 'current',
and shouldn't the field set to be 'current' when selected return a
timestamp with the time as of selection?

--
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio. http://www.targabot.com

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Joseph Shraibman (#3)
Re: 'current' timestamp bug

Joseph Shraibman writes:

It doesn't indicate that 'current_timestamp' is the same as 'current',

That's a bug.

and shouldn't the field set to be 'current' when selected return a
timestamp with the time as of selection?

Probably. 'current' is just weird and will be removed in 7.2.

--
Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter