Re: SQL Server -> Postgres migration: Stored Procedure replacement? - Mailing list pgsql-general

From Tom Lane
Subject Re: SQL Server -> Postgres migration: Stored Procedure replacement?
Date
Msg-id 15156.988644517@sss.pgh.pa.us
Whole thread Raw
In response to SQL Server -> Postgres migration: Stored Procedure replacement?  ("Eliel Mamousette" <eliel@panix.com>)
Responses RE: SQL Server -> Postgres migration: Stored Procedure replacement?
List pgsql-general
"Eliel Mamousette" <eliel@panix.com> writes:
> I have tried using the SETOF operand in the CREATE FUNCTION
> statement, and that allows me to return more than one row,
> but haven't had any luck with specifying more than one return
> type and hence more than one column.

You don't specify more than one return type --- you specify one return
type that is a composite type.  Composite types are currently tied to
tables; creating a table also creates a type that represents one of its
rows.  Thus

    create table foo (a int, b int);

    create function foobar (...) returns foo as ...

Note that there are some annoying syntactic limitations on what you can
actually *do* with a function returning tuples.  We have plans to
improve that situation in 7.2 or beyond, but for now, this facility
isn't nearly as useful as one might think.

            regards, tom lane

pgsql-general by date:

Previous
From: "Fred Ingham"
Date:
Subject: RE: PostgreSQL and mySQL database size question
Next
From: Peter Eisentraut
Date:
Subject: Re: System catalogues