Re: [GENERAL] Function, that returns set of 2 tables columns

2007-02-13 Thread Willy-Bas Loos
Creating a view might work. Yeah, if all you use is SELECT, you should probably use a view, then you don't need to specify the output columns in the calling statement, only a WHERE clause. Othrewise, it's the same thing: SELECT * FROM myview WHERE field1=10; Views are transparant in postgresql,

Re: [GENERAL] Function, that returns set of 2 tables columns

2007-02-13 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/13/07 07:46, Dmitriy Chumack wrote: > Hi * > > I need to write a function, that returns a set of all columns from 2 > tables. [snip] > for i in select * from "Table1", "Table2" > loop >return next i; > end loop; [snip] >

Re: [GENERAL] Function, that returns set of 2 tables columns

2007-02-13 Thread A. Kretschmer
am Tue, dem 13.02.2007, um 16:09:16 +0200 mailte Dmitriy Chumack folgendes: > Tuesday, February 13, 2007, 3:55:36 PM, Andreas Kretschmer: > > > am Tue, dem 13.02.2007, um 15:46:19 +0200 mailte Dmitriy Chumack folgendes: > >> Hi * > >> > >> I need to write a function, that returns a set of all

Re: [GENERAL] Function, that returns set of 2 tables columns

2007-02-13 Thread Dmitriy Chumack
Tuesday, February 13, 2007, 3:55:36 PM, Andreas Kretschmer: > am Tue, dem 13.02.2007, um 15:46:19 +0200 mailte Dmitriy Chumack folgendes: >> Hi * >> >> I need to write a function, that returns a set of all columns from 2 >> tables. >> >> e.g. I create such a function: >> >> CREATE OR

Re: [GENERAL] Function, that returns set of 2 tables columns

2007-02-13 Thread Willy-Bas Loos
You need to specify and cast explicitly from your calling statement: SELECT * FROM func1(10) AS (col1 smallint, col2 bigint, col3 date); On 2/13/07, Dmitriy Chumack <[EMAIL PROTECTED]> wrote: Hi * I need to write a function, that returns a set of all columns from 2 tables. e.g. I crea

Re: [GENERAL] Function, that returns set of 2 tables columns

2007-02-13 Thread A. Kretschmer
am Tue, dem 13.02.2007, um 15:46:19 +0200 mailte Dmitriy Chumack folgendes: > Hi * > > I need to write a function, that returns a set of all columns from 2 > tables. > > e.g. I create such a function: > > CREATE OR REPLACE FUNCTION func(val_ int8) > RETURNS SETOF record AS >

[GENERAL] Function, that returns set of 2 tables columns

2007-02-13 Thread Dmitriy Chumack
Hi * I need to write a function, that returns a set of all columns from 2 tables. e.g. I create such a function: CREATE OR REPLACE FUNCTION func(val_ int8) RETURNS SETOF record AS $BODY$ DECLARE i record; BEGIN for i in select * from "Table1", "Table2"