Re: Function, that returns set of 2 tables columns - Mailing list pgsql-general

From Ron Johnson
Subject Re: Function, that returns set of 2 tables columns
Date
Msg-id 45D1C938.2020604@cox.net
Whole thread Raw
In response to Function, that returns set of 2 tables columns  (Dmitriy Chumack <saint.d.a@gmail.com>)
Responses Re: Function, that returns set of 2 tables columns
List pgsql-general
-----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]
>
>   This two tables have about 20 columns together, so I don't want list
>   them each I call this function. Can I achieve this in some other
>   (right) way?
>
>   P.S. I don't want to create a specific type for this purpose, but
>   if there is no other way, I should.

What do these tables join on?

Creating a view might work.

CREATE VIEW V_SIDE_BY_SIDE AS
    SELECT T1.*, T2.*
    FROM TABLE1 T1,
         TABLE2 T2
    WHERE T1.PK = T2.PK;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF0ck4S9HxQb37XmcRAjPEAJ9qaHwa5mbKiFVqcfEZbPXIX7GmIwCgzvvs
zCPM45xZ590kv2xXnIoSsqM=
=NkbJ
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Function, that returns set of 2 tables columns
Next
From: John McCawley
Date:
Subject: Possible outer join bug with coalesce in 8.2