Re: [HACKERS] Odd behavior of type coercion for datetime
От | Bruce Momjian |
---|---|
Тема | Re: [HACKERS] Odd behavior of type coercion for datetime |
Дата | |
Msg-id | 199903151437.JAA12447@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Odd behavior of type coercion for datetime (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: [HACKERS] Odd behavior of type coercion for datetime
|
Список | pgsql-hackers |
Have we dealt with this? > With 6.4 or current sources, I find that coercing a datetime to float8 > is a no-op: > > treetest=> create table dt1 (t datetime); > CREATE > treetest=> insert into dt1 values('now'); > INSERT 159593 1 > treetest=> select t from dt1; > t > ---------------------------- > Sun Jan 24 18:28:50 1999 EST > (1 row) > > treetest=> select t::float8 from dt1; > ?column? > ---------------------------- > Sun Jan 24 18:28:50 1999 EST > (1 row) > > > I was expecting to get either some numerical equivalent to the date > (seconds since 1970 would do nicely, but I'll take the internal rep...) > or an error message saying "no such conversion available". I was > certainly not expecting to find that the result was still a datetime, > but such it appears to be. This is a bug, wouldn't you say? > > What's even more curious is that coercing to int4 does produce > something numeric: > > treetest=> select t::int4 from dt1; > int4 > --------- > -29464270 > (1 row) > > > regards, tom lane > > -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania19026
В списке pgsql-hackers по дате отправления: