Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: [GENERAL] Returning a RECORD, not SETOF RECORD


  • From: Thomas Hallgren <thhal(at)mailblocks(dot)com>
  • To: Michael Fuhr <mike(at)fuhr(dot)org>
  • Cc: pgsql-hackers(at)postgresql(dot)org
  • Subject: Re: [GENERAL] Returning a RECORD, not SETOF RECORD
  • Date: Fri, 29 Apr 2005 08:26:47 +0200
  • Message-id: <4271D3A7(dot)9050305(at)mailblocks(dot)com>

Michael Fuhr wrote:

On Thu, Apr 28, 2005 at 09:47:45PM +0200, Thomas Hallgren wrote:
What version of PostgreSQL are you using
The latest and greatest from CVS.

Which branch?  HEAD?  REL8_0_STABLE?
Sorry. To me "latest" always defaults to HEAD and by "greatest" I mean the coming 8.1.

Wouldn't it make sense to be able to define a record in the projection part of a query, similar to what I was attempting with my SELECT? Has this been discussed or is it just considered as not very useful?

Sounds reasonable to me, but if it's currently possible then I
haven't yet figured out how to do it.  I can't remember if it's
been discussed before or not.  If nobody answers here then you
might try pgsql-hackers.

Ok. Thanks. I'll redirect this to hackers and see if I have any luck there. My original question was:

I do the following:

CREATE FUNCTION xyz(int, int) RETURNS RECORD AS '...'
CREATE TABLE abc(a int, b int);

Now I want to call my xyz function once for each row in abc and I want my RECORD to be (x int, y int, z timestamptz). How do I write that query? I.e. where do specify my RECORD definition? Is it possible at all? Ideally I'd like to write something like this:

SELECT xyz(a, b) AS (x int, y int, z timestamptz) FROM abc;

but that yields a syntax error.

Regards,
Thomas Hallgren




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group