pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lucas Brito <lucas75@gmail.com>
To: Nicholas I <nicholas.domnic.i@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Comparing two tables of different database
Date: Sat, 2 May 2009 12:01:09 -0300
Message-ID: <cccdaefb0905020801i68426f57ycd892021bf27bd8b@mail.gmail.com> (raw)
In-Reply-To: <e13d0d10904300312j5ec7baa1l3ae91724f6f5dbf8@mail.gmail.com>
References: <e13d0d10904282339r1f853e1cpe3514e53ae47e5ef@mail.gmail.com>
	<cc4f12900904290533x5e1871fdu8f8a27dc956ca616@mail.gmail.com>
	<328DDBBB-31C4-41D7-BF0E-5ADD732F2B9F@mac.com>
	<20090430033747.GB1126@eddie>
	<e13d0d10904300312j5ec7baa1l3ae91724f6f5dbf8@mail.gmail.com>

Nicholas,

To use the dblink:

   1. In your postgres server you should find a file *dblink.sql*.
   In my beta installation is in *share/postgresql/contrib*. It is the
   installation for the dblink contrib module that usually is already compiled
   in. It will create a lot of dblink functions.

   2. on database2 create a function nammed db_datbase1() which returns
   "dbname=database1" (if you need a login use "dbname=database1 password=xxx",
   you can also specify host= port= to connect in a remote postgresql database)

   3. now execute the sql:
   select * from dblink(db_database1(), 'select "id", "name", "time" from
   pr_1') as pr_1("id" integer, "name" text, "time" time)
   then you will see the table "pr_1" on the datbase2

-- 
Lucas Brito

view thread (18+ messages)  latest in thread

Message-ID: <cccdaefb0905020801i68426f57ycd892021bf27bd8b@mail.gmail.com>
Permalink:  ../cccdaefb0905020801i68426f57ycd892021bf27bd8b@mail.gmail.com/
Also on:    postgresql.org/message-id/cccdaefb0905020801i68426f57ycd892021bf27bd8b@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: lucas75@gmail.com, nicholas.domnic.i@gmail.com
  Subject: Re: Comparing two tables of different database
  In-Reply-To: <cccdaefb0905020801i68426f57ycd892021bf27bd8b@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox