How can I use UNION in VIEW/RULE?

From: Werachart Jantarataeme <it072560(at)it(dot)kmutt(dot)ac(dot)th>
To: pgsql-general(at)postgresql(dot)org
Subject: How can I use UNION in VIEW/RULE?
Date: 1999-05-09 16:27:08
Message-ID: Pine.GSO.3.93.990509090636.2441A-100000@pegasus2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have 2 table say c1,c2 (same attributes) and then I would like to

CREATE VIEW c AS
SELECT * FROM c1
UNION
SELECT * FROM c2;

But the system not accept. (not implement)
Then I change to use
CRATE TABLE c (<** attributes are same as c1,c2 **>)
CREATE RULE r1 AS ON SELECT to c
DO INSTEAD
SELECT * FROM c2
UNION
SELECT * FROM c1;

Tbe system accept this rule but when I process 'SELECT * FROM c1;', the
result is not sastified; only tuples on c2 are display.

Is there other way to get result like above. One I've thought in mind is:-
CREATE RULE r1 AS ON SELECT to c
DO INSTEAD
SELECT funct_UNION(c1,c2);
But I have no idea how to do kinds of the function that return set of
tuple

WChart.

Browse pgsql-general by date

  From Date Subject
Next Message fabian baena 1999-05-09 17:49:36 Re: [GENERAL] Empty Date Field
Previous Message Thomas Reinke 1999-05-09 16:21:57 Re: [GENERAL] PostGreSQL and LiveWire??