Обсуждение: 'current' timestamp bug

Поиск
Список
Период
Сортировка

'current' timestamp bug

От
Joseph Shraibman
Дата:
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

Re: 'current' timestamp bug

От
Peter Eisentraut
Дата:
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


Re: 'current' timestamp bug

От
Joseph Shraibman
Дата:
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

Re: 'current' timestamp bug

От
Peter Eisentraut
Дата:
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