Re: Comparing two tables of different database
| От | Lucas Brito |
|---|---|
| Тема | Re: Comparing two tables of different database |
| Дата | |
| Msg-id | cccdaefb0905020801i68426f57ycd892021bf27bd8b@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Comparing two tables of different database (Nicholas I <nicholas.domnic.i@gmail.com>) |
| Список | pgsql-sql |
Nicholas,<br /><br />To use the dblink:<br /><ol><li>In your postgres server you should find a file <b>dblink.sql</b>.
<br/> In my beta installation is in <b>share/postgresql/contrib</b>. It is the installation for the dblink contrib
modulethat usually is already compiled in. It will create a lot of dblink functions.<br /><br /><li>on database2 create
afunction 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)<br /><br /><li>now execute
thesql:<br /><span style="color: rgb(0, 0, 153);">select * from dblink(db_database1(), 'select "id", "name", "time"
frompr_1') as pr_1("id" integer, "name" text, "time" time)<font color="#000000"><br /> then you will see the table
"pr_1"on the datbase2</font> </span></ol>-- <br />Lucas Brito
В списке pgsql-sql по дате отправления: