Re: Stored Procedures - Mailing list pgsql-novice

From Josh Berkus
Subject Re: Stored Procedures
Date
Msg-id web-1452560@davinci.ethosmedia.com
Whole thread Raw
In response to Stored Procedures  (Wendy Powley <wendy@cs.queensu.ca>)
List pgsql-novice
Wendy,

> Is it possible to write a stored procedure which takes a struct as a
> parameter?  I'd like to be able to pass in some info via a struct &
> return some info via another struct something like this:

What's a "Struct"?  It's not a standard SQL term, and I don't recognize
it.


> struct in_struct {
>   integer i, j;
> }
>
> struct out_struct {
>   integer k;
>    char p;
> }

Are you trying for a custom data type, or more of a record?  Postgres
supports both.

> create function myfunc(in_struct, out_struct) .....

Postgres does not support output parameters, at present.  Functions
have one return value of a defined data type (which may be a custom
data type or a record, if you wish).

-Josh Berkus



pgsql-novice by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: Problems with psql : ERROR : pg_user: permission
Next
From: "Josh Berkus"
Date:
Subject: Re: Stored Procedures