dbTalk Databases Forums  

postgres 9.0 - NOT IN over 2 databases

comp.databases.postgresql comp.databases.postgresql


Discuss postgres 9.0 - NOT IN over 2 databases in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bjarne Jensen
 
Posts: n/a

Default postgres 9.0 - NOT IN over 2 databases - 08-27-2011 , 04:41 PM






I get a "new" database every 4 weeks. They all have the same schema.

I need to find out what changes were done to certain tables from one
issue to the next.

Presently I COPY a table from OLD_db to file and then import it in the
NEW_db where I can compare the tables - like this:

SELECT a,i FROM db_OLD_t WHERE i NOT IN (SELECT i FROM db_NEW_t);

Now, is there some way I can create a (as in 'one') query that can span
2 databases?


/Bjarne

Reply With Quote
  #2  
Old   
Mladen Gogala
 
Posts: n/a

Default Re: postgres 9.0 - NOT IN over 2 databases - 08-28-2011 , 11:08 AM






On Sat, 27 Aug 2011 23:41:31 +0200, Bjarne Jensen wrote:

Quote:
I get a "new" database every 4 weeks. They all have the same schema.

I need to find out what changes were done to certain tables from one
issue to the next.

Presently I COPY a table from OLD_db to file and then import it in the
NEW_db where I can compare the tables - like this:

SELECT a,i FROM db_OLD_t WHERE i NOT IN (SELECT i FROM db_NEW_t);

Now, is there some way I can create a (as in 'one') query that can span
2 databases?


/Bjarne
The dblink extension will help you with that. Essentially, you create
another connection and retrieve the query results. Here is the
documentation:
http://www.postgresql.org/docs/curre...ic/dblink.html

If you don't want that, there is always replication like Slony, which is
simple to set up and works very reliably, at least in my experience.
There is nothing like "select * from emp@dblink" in Postgres.



--
http://mgogala.byethost5.com

Reply With Quote
  #3  
Old   
Bjarne Jensen
 
Posts: n/a

Default Re: postgres 9.0 - NOT IN over 2 databases - 08-29-2011 , 01:48 AM



dblink looks good, thanks!

/Bjarne

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.