Re: [GENERAL] function returning setof..select versus select * from

2008-10-06 Thread Tom Lane
Jeff Amiel <[EMAIL PROTECTED]> writes: > What is the difference between: > select foo(); > and > select * from foo(); They're implemented differently, partly for legacy or lack-of-round-tuit reasons, and partly because different PLs prefer different strategies for returning sets. The first form o

Re: [GENERAL] Function Returning SETOF RECORD: Trouble With Char Type

2008-03-20 Thread Angus B. Atkins-Trimnell
Thanks a lot. I missed your post when it first came up, but I just tried double-quoting the type indicator and it worked like a charm! --Angus Tom Lane wrote: "Angus B. Atkins-Trimnell" <[EMAIL PROTECTED]> writes: I am having trouble with a function designed to return all column constrain

Re: [GENERAL] Function Returning SETOF RECORD: Trouble With Char Type

2008-03-12 Thread Tom Lane
"Angus B. Atkins-Trimnell" <[EMAIL PROTECTED]> writes: > I am having trouble with a function designed to return all column > constraints on a table. I think the problem is that you're declaring the contype return column as char (ie, character(1)) when pg_constraint.contype is actually "char" (a h

Re: [GENERAL] Function returning setof more than 1 table

2006-10-27 Thread Merlin Moncure
On 10/27/06, J S B <[EMAIL PROTECTED]> wrote: Can I have a function (language sql) returning SETOF more than one table? Thanks, Jas no, but you can return a record of refcursors. note this is plpgsql. if you are willing to bend on the language, you will find refcursors to be pretty cool, you

Re: [GENERAL] Function returning setof more than 1 table

2006-10-27 Thread A. Kretschmer
am Fri, dem 27.10.2006, um 4:30:47 -0400 mailte J S B folgendes: > Can I have a function (language sql) returning SETOF more than one table? You can create some tables within the function... Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header) Gn

Re: [GENERAL] Function returning SETOF

2005-12-02 Thread Terry Lee Tucker
Simpler is better ;o) Thanks for the input... On Thursday 01 December 2005 10:31 pm, David Fetter saith: > On Thu, Dec 01, 2005 at 12:32:02PM -0500, Terry Lee Tucker wrote: > > List, > > > > I have a simple function: > > I have a simpler one :) > > CREATE OR REPLACE FUNCTION split_to_rows(TEXT, T

Re: [GENERAL] Function returning SETOF

2005-12-01 Thread David Fetter
On Thu, Dec 01, 2005 at 12:32:02PM -0500, Terry Lee Tucker wrote: > List, > > I have a simple function: I have a simpler one :) CREATE OR REPLACE FUNCTION split_to_rows(TEXT, TEXT) /* Descriptive name */ RETURNS SETOF TEXT STRICT LANGUAGE sql AS $$ SELECT (string_to_array($1, $2))[s.i] F

Re: [GENERAL] Function returning SETOF

2005-12-01 Thread Tony Caduto
Terry Lee Tucker wrote: List, I have a simple function: CREATE OR REPLACE FUNCTION parse_string (TEXT, TEXT) RETURNS SETOF TEXT AS ' DECLARE str ALIAS FOR $1; -- the string to parse delimiter ALIAS FOR $2; -- the delimiter field TEXT;

Re: [GENERAL] Function returning SETOF

2005-12-01 Thread Terry Lee Tucker
I knew I was doing something stupid. Right after I sent this I realized I was calling incorrectly. This works: rnd=# select * from parse_string ('1/2/3/4/5', '/'); NOTICE: parse_string () parse_string -- 1 2 3 4 5 (5 rows) And so does this: rnd=# select ARRAY(SELECT * from pars

Re: [GENERAL] Function Returning SETOF Problem

2003-12-17 Thread Stephan Szabo
On Wed, 17 Dec 2003, Ron St-Pierre wrote: > Stephan Szabo wrote: > > >On Wed, 17 Dec 2003, Ron St-Pierre wrote: > > > > > > > >>On a daily basis I place a lot of data into the empty table dailyList, > >>and from that data update certain fields in currentList. I thought that > >>using a function wo

Re: [GENERAL] Function Returning SETOF Problem

2003-12-17 Thread Tom Lane
Ron St-Pierre <[EMAIL PROTECTED]> writes: > On a daily basis I place a lot of data into the empty table dailyList, > and from that data update certain fields in currentList. I thought that > using a function would be a good way to do this(?). However I get the > following error when I run update

Re: [GENERAL] Function Returning SETOF Problem

2003-12-17 Thread Ron St-Pierre
Stephan Szabo wrote: On Wed, 17 Dec 2003, Ron St-Pierre wrote: On a daily basis I place a lot of data into the empty table dailyList, and from that data update certain fields in currentList. I thought that using a function would be a good way to do this(?). However I get the following error wh

Re: [GENERAL] Function Returning SETOF Problem

2003-12-17 Thread Stephan Szabo
On Wed, 17 Dec 2003, Ron St-Pierre wrote: > On a daily basis I place a lot of data into the empty table dailyList, > and from that data update certain fields in currentList. I thought that > using a function would be a good way to do this(?). However I get the > following error when I run updateC