Re: SQL Server -> Postgres migration: Stored Procedure replacement?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Eliel Mamousette" <eliel(at)panix(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL Server -> Postgres migration: Stored Procedure replacement?
Date: 2001-04-30 15:28:37
Message-ID: 15156.988644517@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

"Eliel Mamousette" <eliel(at)panix(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Randall Perry 2001-04-30 15:52:06 PHPPgAdmin or MS Access
Previous Message Dave Cramer 2001-04-30 15:14:28 Re: Help, I dropped a system datatype, and now I'm ....

Browse pgsql-sql by date

  From Date Subject
Next Message John Coers 2001-04-30 19:12:22 Re: Performance with Large Volumes of Data
Previous Message Steve Meynell 2001-04-30 15:15:20 Re: Heres a good one...