Re: polymorphic functions and domains

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: polymorphic functions and domains
Дата
Msg-id 5167.1196988696@sss.pgh.pa.us
обсуждение исходный текст
Ответ на polymorphic functions and domains  (TJ O'Donnell <tjo@acm.org>)
Ответы Re: polymorphic functions and domains
Список pgsql-sql
"TJ O'Donnell" <tjo@acm.org> writes:
> I really want two polymorphic functions, one taking
> a domain data type using varchar and one bytea.

These aren't polymorphic functions, actually; they're just overloaded.

> In that case, postgres complains that it cannot decide
> which one to use when called with the
> untyped literal 'abc'.

Yeah, functions taking domains as arguments are problematic.  I believe
that with the current resolution rules, a function taking a domain can
only "win" an ambiguous-function comparison if it's an exact match
to the input types --- which in this case means you have to cast the
literal to the domain type.

There's been some talk of trying to rejigger the resolution rules to
make them more friendly to functions that're declared to take domains,
but no one's put forward any concrete proposal.  It's not at all clear
to me how to do it without introducing a lot of surprising behavior :-(
        regards, tom lane


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

Предыдущее
От: Erik Jones
Дата:
Сообщение: Rule rewrite to possible union?
Следующее
От: "Stefan Scheidegger"
Дата:
Сообщение: INSERT INTO relational tables