From: Leif B. Kristensen <leif@solumslekt.org>
To: pgsql-sql@postgresql.org
Subject: Re:
Date: Thu, 9 Mar 2006 14:49:34 +0100
Message-ID: <200603091449.35028.leif@solumslekt.org> (raw)
In-Reply-To: <b62baae3da9741128a55d5039b7845ea@wol.co.za>
References: <b62baae3da9741128a55d5039b7845ea@wol.co.za>
On Thursday 09 March 2006 14:35, Klay Martens wrote:
><p class="MsoNormal"><span lang="EN-ZA">Hi all.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">I am new to postgres, so I am
> still learning the basics.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">In Sequel Server, one can set
> up a function to return a table eg:<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><o:p> </o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">CREATE FUNCTION
> [dbo].[AuthCodes] (@CLIENTID INT)<span style="">
> </span><o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">RETURNS @AuthCodes
> TABLE<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">(<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>[ID] INT,<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>AUTHCODE VARCHAR(100),<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>ISSUEDATE DATETIME,<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>ISSUEDBY VARCHAR(100),<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>RECIPIENT VARCHAR(100),<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><span
> style="">
> </span>EMAILID VARCHAR(100)<span style="">
> </span><o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">)<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA"><o:p> </o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">and then use select into or
> insert to populate the table.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">I am really battling to figure
> out how to do the same in a postgres function.<o:p></o:p></span></p>
>
>
><p class="MsoNormal"><span lang="EN-ZA">It seems like one would have
> to create a user defined type (myType for eg), and then set the
> return type of the function to be a set of myType, but I can’t seem
> to make it work. I am guessing that I am on the wrong track…does
> anyone have any suggestions, or examples I could
> follow?<o:p></o:p></span></p>
Please don't post HTML messages to mail lists.
--
Leif Biberg Kristensen | Registered Linux User #338009
http://solumslekt.org/ | Cruising with Gentoo/KDE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: leif@solumslekt.org
Subject: Re:
In-Reply-To: <200603091449.35028.leif@solumslekt.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox