Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 011349F9F5D for ; Tue, 21 Aug 2007 22:42:28 -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 78382-02 for ; Tue, 21 Aug 2007 22:42:16 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.188]) by postgresql.org (Postfix) with ESMTP id DD07A9F9F20 for ; Tue, 21 Aug 2007 22:42:24 -0300 (ADT) Received: by rv-out-0910.google.com with SMTP id c24so17760rvf for ; Tue, 21 Aug 2007 18:42:23 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uKo0s9rvLAc42s+7YJd5mizOFgHzvLaqYMAOcfbq6gj7yxiLTWF+w0DKj9acKGoSKIi7V0CayU5BgQTs4jtO06iPTRhnVAWDsJmdOm2q/2zTGmVfh2KSrNOXiTweOoJALFcavdnmBNW2HXbqyxP06og8G766ZuNWslKkO31dH78= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=gYNeT+UitlfzPMg16Jk4VehKIOfdv6Jg3cTX9M1KJixNjxVuweGDGmvnvt6FcCww/HiyznglLGyAyvRphdc6dXxoR1R0Wl7zaeOpg2ao43EULmOm8JUfrmV4Jn1/J93SXkO4+KaOygSUHi4bqZGyDxLJEv6IWXfWjFi9ZmQ6vls= Received: by 10.141.202.12 with SMTP id e12mr39063rvq.1187746943316; Tue, 21 Aug 2007 18:42:23 -0700 (PDT) Received: by 10.141.98.12 with HTTP; Tue, 21 Aug 2007 18:42:23 -0700 (PDT) Message-ID: Date: Tue, 21 Aug 2007 20:42:23 -0500 From: "Scott Marlowe" To: "Gregory Stark" Subject: Re: SELECT syntax synopsis: column_definition? Cc: "Michael Glaesemann" , "Richard Broersma Jr" , "SQL Postgresql List" In-Reply-To: <87zm0kigwe.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <830878.14424.qm@web31803.mail.mud.yahoo.com> <50700110-2B0D-4935-B033-084ED908BEC5@seespotcode.net> <87zm0kigwe.fsf@oxford.xeocode.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/184 X-Sequence-Number: 29122 On 8/21/07, Gregory Stark wrote: > "Michael Glaesemann" writes: > > > ERROR: a column definition list is only allowed for functions returning > > "record" > > > > So the *form* is right, but I don't know of an example that works. > > postgres=# create function testf() returns record as 'select 1' language sql; > CREATE FUNCTION > postgres=# select * from testf() as (i integer); > i > --- > 1 > (1 row) > > > I haven't quite figured out how this is useful though. It probably makes more > sense if you use plpgsql but I still don't quite see what the use case is. I use them with the crosstab function in the tablefunc contrib module.