[pgsql-jp: 29779] Re: Unable to convert date to tm

Masato Tanaka pgsql @ e-linez.com
2003年 5月 2日 (金) 11:30:52 JST


書き忘れておりました。
OSはRedhat Linux7.3です。

> こんにちは。田中と申します。
>
> 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 メーリングリストの案内