[HACKERS] lag(bigint,int,int), etc?

Поиск
Список
Период
Сортировка
От Colin 't Hart
Тема [HACKERS] lag(bigint,int,int), etc?
Дата
Msg-id CAMon-aS9-dSY49Qzm2jgdAxsEbZ=Ff2CNyM9bS2PN2jEyHpjyA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] lag(bigint,int,int), etc?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-hackers
Hi,

The following rather contrived example illustrates that lag(), lead()
(and probably other functions) can't automatically cast an integer to
a bigint:

select lag(sum,1,0) over () from (select sum(generate_series) over
(order by generate_series) from generate_series(1,10)) x;
ERROR:  function lag(bigint, integer, integer) does not exist
LINE 1: select lag(sum,1,0) over () from (select sum(generate_series...              ^
HINT:  No function matches the given name and argument types. You
might need to add explicit type casts.


I guess this is because the lag() and lead() functions take any type,
and hence the default must be of the same type.
This had me stumped for a few while until I realised that the types
were different.

Would there be any way to implement an automatic conversion?

On the off-chance that this is actually a bug, this is on 9.6.3, but
it also occurs on 9.3.17

Thanks,

Colin



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] CREATE COLLATION definitional questions for ICU
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: [HACKERS] lag(bigint,int,int), etc?