X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id BC084D1C4C1 for ; Wed, 23 Jul 2003 19:31:48 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 52015-10 for ; Wed, 23 Jul 2003 16:31:07 -0300 (ADT) Received: from varlena.com (adsl-63-207-12-154.dsl.snfc21.pacbell.net [63.207.12.154]) by svr1.postgresql.org (Postfix) with ESMTP id EFB1FD1C7F2 for ; Wed, 23 Jul 2003 16:31:46 -0300 (ADT) Received: by varlena.com (Postfix on SuSE Linux 7.3 (i386), from userid 500) id E6376394BA; Wed, 23 Jul 2003 12:27:23 -0700 (PDT) Date: Wed, 23 Jul 2003 12:27:23 -0700 From: elein To: Tom Lane Cc: elein , Robert Treat , pgsql-sql@postgresql.org Subject: Re: obtuse plpgsql function needs Message-ID: <20030723122723.C26401@cookie> References: <1058913112.22259.271.camel@camel> <20030722163335.A18881@cookie> <1058965609.22259.292.camel@camel> <20030723111201.D20411@cookie> <15642.1058987750@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15642.1058987750@sss.pgh.pa.us> User-Agent: Mutt/1.3.22.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/344 X-Sequence-Number: 14458 So, other than C, plperl or pltcl is the way to go. As long as they can input generic composite types (I wasn't sure of that, but I should have known), they can access columns as array elements so you can loop through them. And they'll tell you the number of arguments. Ta da! elein On Wed, Jul 23, 2003 at 03:15:50PM -0400, Tom Lane wrote: > elein writes: > > You can do it in C, of course. > > Yeah. Also you could do it easily in plperl or pltcl (composite-type > arguments get passed as perl hashes or Tcl arrays respectively). > plpgsql does not have any facility for run-time determination of field > names, so you're pretty much out of luck in that particular language. > > regards, tom lane >