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,
-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]
>
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
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
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
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
>
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"