Re: marking record origin in views

From: "Peter Alberer" <h9351252(at)obelix(dot)wu-wien(dot)ac(dot)at>
To: "'Claudio Lapidus'" <clapidus(at)hotmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: marking record origin in views
Date: 2003-11-26 14:55:02
Message-ID: 000301c3b42d$487faa00$5be0d089@ekelhardt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hmm, what about

create view v1 as
select *,1 as source from t1
union
select *,2 as source from t2;

>Hello list
>
>I have two tables with identical structure, one holds 'correct' data
(from
>an application standpoint) and the other has data 'in error'. Anyway, I
>need
>sometimes to query both tables at the same time, so I constructed an
>elementary view
>
>create view v1 as select * from t1 union select * from t2;
>
>But I would like to have an extra field (in the view) with the table
name
>of
>the particular record source. How can this be done?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2003-11-26 14:59:54 Re: duplicate primary key entries?
Previous Message Claudio Lapidus 2003-11-26 14:19:34 marking record origin in views