Re: Possibly odd question; diff results?
От | Merlin Moncure |
---|---|
Тема | Re: Possibly odd question; diff results? |
Дата | |
Msg-id | b42b73150702090553i7d83d41m3a0c329fa9ca5dbd@mail.gmail.com обсуждение исходный текст |
Ответ на | Possibly odd question; diff results? (Madison Kelly <linux@alteeve.com>) |
Ответы |
Re: Possibly odd question; diff results?
|
Список | pgsql-general |
On 2/8/07, Madison Kelly <linux@alteeve.com> wrote: > Hi all, > > I've got a 'history' schema that records changes in the public schema > tables over time. I use a trigger and function to do this. What I would > like to do though, and this may not even be possible, is say something > like (pseudo-code) "SELECT DIFF foo_name FROM history.foo WHERE > foo_id=X;" and have a *nix 'diff' style results shown (sort of like > looking at diffs in CVS/SVN). you can start by using the 'except' boolean query operator; select * from foo except * from bar; This will give you rows in foo that are not exactly in bar (matching every field). If you want it in both directions you can: (select * from foo except select * from bar) union (select * from bar except select * from foo); you can then take the results of these queries and mark up the text however you want. Just a heads up: the boolean sql operators are famous for generating sequential scans. merlin
В списке pgsql-general по дате отправления: