Functions returning RECORD

From: Thomas Hallgren <thhal(at)mailblocks(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Functions returning RECORD
Date: 2005-04-21 08:32:37
Message-ID: 42676525.40408@mailblocks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a question about syntax and feasibility.

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

Browse pgsql-general by date

  From Date Subject
Next Message Steve - DND 2005-04-21 08:41:24 Raise exception from regular SQL?
Previous Message Daniel Schuchardt 2005-04-21 08:20:18 Re: Windows install/uninstall as a "service"