Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id F2F16C24694 for ; Fri, 30 Dec 2011 10:50:04 -0400 (AST) Received: from mail-iy0-f174.google.com ([209.85.210.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RgdmU-0003u8-10 for pgsql-sql@postgresql.org; Fri, 30 Dec 2011 14:50:04 +0000 Received: by iaeh11 with SMTP id h11so25406580iae.19 for ; Fri, 30 Dec 2011 06:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=VO0rG4H8bQQRtZ86768xwJhLD4JhzDDEP2eeAvhahz8=; b=itdWOJtTsk3Gw1Z2PSDbgDKqO3LApHZ4rh5C1fFjiVNGyDIiQK2eLL6nEaHUU7yuUr 0IZ+7yIPR7wmLPQwWDVpvNUgUFQx/fOLjvVpLWQwwQeVEBfcm1BS6GIu3nCrSwmjk6vB zPdc2jNVqoC7SfRQXbKABaeU2gtacW1HWlVww= Received: by 10.43.45.137 with SMTP id uk9mr41046317icb.52.1325256586883; Fri, 30 Dec 2011 06:49:46 -0800 (PST) Received: from tucker.localnet (c-24-17-164-54.hsd1.wa.comcast.net. [24.17.164.54]) by mx.google.com with ESMTPS id lu10sm64485805igc.0.2011.12.30.06.49.45 (version=SSLv3 cipher=OTHER); Fri, 30 Dec 2011 06:49:46 -0800 (PST) From: Adrian Klaver To: pgsql-sql@postgresql.org Subject: Re: avoid the creating the type for setof Date: Fri, 30 Dec 2011 06:49:42 -0800 User-Agent: KMail/1.13.5 (Linux/2.6.32-37-generic; KDE/4.4.5; i686; ; ) Cc: John Fabiani References: <1762087.ynHxkPSFx3@linux-12> In-Reply-To: <1762087.ynHxkPSFx3@linux-12> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112300649.42983.adrian.klaver@gmail.com> X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201112/99 X-Sequence-Number: 36160 On Friday, December 30, 2011 6:26:19 am John Fabiani wrote: > Hi, > I recall somewhere I saw a simple plpgsql function that returned a table > with more than one record that did not use a defined type or a temp table > ( at least I think I did). Is it possible to create such a function that > will return more than one record and not require a record type or temp > table? > > something like > > return setof record as > return query select ... http://www.postgresql.org/docs/9.0/interactive/plpgsql-declarations.html#PLPGSQL-DECLARATION-PARAMETERS 39.3.1. Declaring Function Parameters Search for RETURNS TABLE > > return > > > Johnf -- Adrian Klaver adrian.klaver@gmail.com