Resolving polymorphic functions with related datatypes

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Resolving polymorphic functions with related datatypes
Дата
Msg-id 1215077769.3845.753.camel@ebony.site
обсуждение исходный текст
Ответы Re: Resolving polymorphic functions with related datatypes  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Re: Resolving polymorphic functions with related datatypes  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Список pgsql-hackers
I'm using the nvl() function from the orafce package. It is defined as a
polymorphic function so its function signature is  nvl(anyelement, anyelement)

Now if I try to use the function in this very typical way nvl(numeric_col, 0)

we get
ERROR: function nvl(numeric, integer) does not exist

The same error occurs if we have nvl(smallint, integer) etc

This is a real shame 'cos polymorphic functions ought to be a great way
of saving development time and catalog space, yet they seem to fall down
a hole without implicit casting.

What I'd like it to do is to recognise that the 0 should be cast
implicitly to another datatype within the same family. I want and expectnvl(char_column, 0)
to fail, but I expect the various numeric/integer types we have to play
nicely together without tears.

If we can do it for indexes, can we do it for polymorphic functions also
when there is no matching function?

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Training, Services and Support



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

Предыдущее
От: Gregory Stark
Дата:
Сообщение: Re: WIP patch: reducing overhead for repeat de-TOASTing
Следующее
От: Mark Cave-Ayland
Дата:
Сообщение: Re: WIP patch: reducing overhead for repeat de-TOASTing