[pgsql-jp: 39894] Re: (解決)Lead関数で第3引数を指定すると文法エラーになる。

postgresqlmailabcd @ mail.goo.ne.jp postgresqlmailabcd @ mail.goo.ne.jp
2009年 6月 20日 (土) 14:01:02 JST


>★= proargtypes(引数の型) が 2283(anyelement), 23(int4), 2283(anyelement) の必要あり。
>
>なので、例えば以下の様にすると通ると思います。
>
>-- Val と 999 を smallint で統一
>select ID,SortKey,Val,
>Lead(Val,2,999::smallint) over(partition by ID order by SortKey)
>  from tes;
>
>-- Val と 999 を int で統一
>select ID,SortKey,Val,
>Lead(Val::int,2,999) over(partition by ID order by SortKey)
>  from tes;

型の統一で解決しました。
ありがとうございました。



pgsql-jp メーリングリストの案内