pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: TJ O'Donnell <tjo@acm.org>
Cc: PostgreSQL - SQL <pgsql-sql@postgresql.org>
Subject: Re: polymorphic functions and domains
Date: Thu, 06 Dec 2007 19:51:36 -0500
Message-ID: <5167.1196988696@sss.pgh.pa.us> (raw)
In-Reply-To: <47584418.1020204@acm.org>
References: <47584418.1020204@acm.org>

"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



view thread (3+ messages)  latest in thread

Message-ID: <5167.1196988696@sss.pgh.pa.us>
Permalink:  ../5167.1196988696@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5167.1196988696@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tjo@acm.org
  Subject: Re: polymorphic functions and domains
  In-Reply-To: <5167.1196988696@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox