Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 9C9672E0035 for ; Thu, 6 Dec 2007 20:51:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 65237-06 for ; Thu, 6 Dec 2007 20:51:40 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 89AF82E022A for ; Thu, 6 Dec 2007 20:51:40 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lB70paFE005168; Thu, 6 Dec 2007 19:51:36 -0500 (EST) To: "TJ O'Donnell" cc: PostgreSQL - SQL Subject: Re: polymorphic functions and domains In-reply-to: <47584418.1020204@acm.org> References: <47584418.1020204@acm.org> Comments: In-reply-to "TJ O'Donnell" message dated "Thu, 06 Dec 2007 10:48:56 -0800" Date: Thu, 06 Dec 2007 19:51:36 -0500 Message-ID: <5167.1196988696@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/22 X-Sequence-Number: 29714 "TJ O'Donnell" 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