Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B1FFD9FB864 for ; Wed, 4 Apr 2007 09:19:35 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 35711-02 for ; Wed, 4 Apr 2007 09:19:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from a2s5.a2hosting.com (a2s5.a2hosting.com [209.124.50.10]) by postgresql.org (Postfix) with ESMTP id 85BE09FB7C3 for ; Wed, 4 Apr 2007 09:19:25 -0300 (ADT) Received: from adsl-6-26-39.tys.bellsouth.net ([65.6.26.39] helo=[192.168.1.12]) by a2s5.a2hosting.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1HZ4SR-00085X-1i; Wed, 04 Apr 2007 08:19:23 -0400 In-Reply-To: <20070404050116.GA27391@a-kretschmer.de> References: <20070404050116.GA27391@a-kretschmer.de> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit From: John DeSoi Subject: Re: plpgsql function question Date: Wed, 4 Apr 2007 08:19:15 -0400 To: A. Kretschmer X-Mailer: Apple Mail (2.752.3) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s5.a2hosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/52 X-Sequence-Number: 28052 If you use a plpgsql function to select the row you want to validate, it will make life much easier. Something like ... $$ declare my_row a_row_type; is_ok integer; begin select into my_row * from a_row_type where .... is_ok := my_a_validate(my_row); return is_ok; $$ ... On Apr 4, 2007, at 1:01 AM, A. Kretschmer wrote: > Because your function expects one parameter of your new type, you have > to CAST your data into this type: > > > > test=# select * from my_a((1, 'foo', current_date)::a); > my_a > ------ > 1 > (1 row) John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL