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 DC99952818 for ; Wed, 6 Jul 2005 11:35:43 -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 92999-02 for ; Wed, 6 Jul 2005 14:35:40 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A8D3F5293D for ; Wed, 6 Jul 2005 11:35:39 -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 j66EZbD6026104; Wed, 6 Jul 2005 10:35:37 -0400 (EDT) To: Robert Perry Cc: pgsql-interfaces@postgresql.org, Bruce Momjian Subject: Re: By Passed Domain Constraints In-reply-to: <61C4410A-F2CE-49E9-92BA-1BDF89818DAA@lodestonetechnologies.com> References: <61C4410A-F2CE-49E9-92BA-1BDF89818DAA@lodestonetechnologies.com> Comments: In-reply-to Robert Perry message dated "Wed, 06 Jul 2005 09:49:27 -0400" Date: Wed, 06 Jul 2005 10:35:37 -0400 Message-ID: <26103.1120660537@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/8 X-Sequence-Number: 5644 Robert Perry writes: > It looks like the data is not checked when passed to the > function and from their on out since it is already the correct type > it is not checked again. Has anyone else seen something like this? IIRC, plpgsql does not know anything about domains and does not enforce domain constraints when assigning to local variables or the function result. The same is true of the other PLs, though I think it could only matter for the function result in those cases (internal variables aren't of SQL types anyway for them). You could probably work around this by writing explicit casts to the domain inside the function, eg "RETURN x::domain" not just "RETURN x". I thought the unfinished work for domains was mentioned on the TODO list but I don't see anything about it right now. regards, tom lane