Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A9DA59FB9C1 for ; Tue, 3 Apr 2007 16:24:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 73338-02 for ; Tue, 3 Apr 2007 16:24:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by postgresql.org (Postfix) with ESMTP id 07DB39FB9B2 for ; Tue, 3 Apr 2007 16:24:22 -0300 (ADT) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1HYoc82W7v-0004J9; Tue, 03 Apr 2007 21:24:21 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1HYoc7-000500-00 for pgsql-sql@postgresql.org; Tue, 03 Apr 2007 21:24:19 +0200 Date: Tue, 3 Apr 2007 21:24:19 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: plpgsql function question Message-ID: <20070403192419.GA19007@a-kretschmer.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX19jgWjW+/xOcjUHzO+A6gKSD9FsqHkfHHFKOya Xg5LXIz8S0PBtdCGlMqu4hbO3ObBzDdewhGl6K38qTFZhE5hN/ sMbjVxLca5HSnFIsjvzvKfes+CHFiLI X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/42 X-Sequence-Number: 28042 am Tue, dem 03.04.2007, um 11:33:39 -0700 mailte Karthikeyan Sundaram folgendes: > Hi, > > I guess there is some misunderstanding from my question Maybe. > > Let me elaborate more clearly. > > My Table is > > Create table a ( > i int, > j varchar(20), > k date); > > Create or replace function a_func (in p_i int, in p_j varchar, in p_k date) > returns int as > $$ > ----- do the validation > return 1; > $$ > language 'plpgsql'; > > This works fine > > What I want is something like this > create or replace functinon a_func (in a%rowtype) returns int as > $$ > ---- do the validation > $$ > language 'plpgsql'; What's the reason? For an INSERT or UPDATE - check? You can use a TRIGGER and check the NEW-structure. Or create a new type, based on the table-structure. Than you can create your function. test=# create type a as ( i int, j varchar(20), k date); CREATE TYPE test=*# create function my_a (IN foo a) returns int as $$begin return 1; end; $$ language plpgsql; CREATE FUNCTION test=*# > > Date: Tue, 3 Apr 2007 20:18:43 +0200 > > From: akretschmer@spamfence.net > > To: pgsql-sql@postgresql.org > > Subject: Re: [SQL] plpgsql function question Please, no silly text above and fullquote below, i'm reading from top to bottom... Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net