X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5571D52815; Wed, 6 Jul 2005 13:06:05 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 20556-01; Wed, 6 Jul 2005 16:06:03 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id F0ECB52809; Wed, 6 Jul 2005 13:05:59 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j66G5wD7027040; Wed, 6 Jul 2005 12:05:58 -0400 (EDT) To: Robert Perry Cc: pgsql-interfaces@postgresql.org, pgsql-hackers@postgresql.org Subject: Re: By Passed Domain Constraints In-reply-to: References: <61C4410A-F2CE-49E9-92BA-1BDF89818DAA@lodestonetechnologies.com> <26103.1120660537@sss.pgh.pa.us> Comments: In-reply-to Robert Perry message dated "Wed, 06 Jul 2005 11:43:06 -0400" Date: Wed, 06 Jul 2005 12:05:58 -0400 Message-ID: <27039.1120665958@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/10 X-Sequence-Number: 5646 Robert Perry writes: > I have also been bitten by the problem you are describing. But, > that one is a problem even when called from psql if I am not > mistaken. Does psql not use pqlib? Perhaps it is something about > PQexecParams that is the problem. I will test in a little while. [ thinks about it... ] If you've declared the function input parameter as a domain type and then write a parameterized query like ... function($1) ... and don't specify any particular datatype for the parameter symbol, I think the backend will infer the domain type as the parameter type. Which would also allow bypassing the domain checks. You could work around this by explicitly specifying the parameter type as text or varchar or whatever the domain's base type is. I wonder though if we oughtn't change the backend so that the inferred type of a parameter symbol is never a domain, but the domain's base type. That would force the proper application of CoerceToDomain inside the constructed query parsetree. regards, tom lane