[pgsql-jp: 29773] Unable to convert date to tm
Masato Tanaka
pgsql @ e-linez.com
2003年 5月 2日 (金) 10:32:32 JST
こんにちは。田中と申します。
Postgres7.2.1で困っています。
日付型のフィールドに、特定の日付が入っていると、TIMESTAMPで値を取得できず、
ERROR: Unable to convert date to tm
というメッセージが出てしまいます。
現状ですが、以下のような、birthday という日付型のフィールドがあるのですが、
birthdayの値によって年齢を取得するSQLがエラーになってしまいます。
[table]
id | birthday
-----|------------
1 | 1948-04-05
2 | 1976-06-07
●成功パターン
=> SELECT extract(year from age(birthday::TIMESTAMP)) as age from table
where id='2';
age
-----
26
●失敗パターン
=> SELECT extract(year from age(birthday::TIMESTAMP)) as age from table
where id='1';
ERROR: Unable to convert date to tm
何かわかりましたら、アドバイスいただけると嬉しいです。
pgsql-jp メーリングリストの案内