From gezeala25@yahoo.com Fri Feb 13 08:56:58 2004 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 65F7ED1D25D for ; Fri, 13 Feb 2004 08:56:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97225-08 for ; Fri, 13 Feb 2004 04:56:56 -0400 (AST) Received: from web41408.mail.yahoo.com (web41408.mail.yahoo.com [66.218.93.74]) by svr1.postgresql.org (Postfix) with SMTP id 4D978D1D26D for ; Fri, 13 Feb 2004 04:56:54 -0400 (AST) Message-ID: <20040213085655.67695.qmail@web41408.mail.yahoo.com> Received: from [203.177.72.130] by web41408.mail.yahoo.com via HTTP; Fri, 13 Feb 2004 08:56:55 GMT Date: Fri, 13 Feb 2004 08:56:55 +0000 (GMT) From: =?iso-8859-1?q?Gezeala=20'Eyah'=20Bacu=F1o=20II?= Subject: How To Connect to another Database inside a plpgsql function To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1584588277-1076662615=:67415" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.4 tagged_above=0.0 required=5.0 tests=FROM_ENDS_IN_NUMS, HTML_FONTCOLOR_BLUE, HTML_FONTCOLOR_RED, HTML_FONTCOLOR_UNSAFE, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200402/29 X-Sequence-Number: 2577 --0-1584588277-1076662615=:67415 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi Guys! I have 2 database namely "DB1" and "DB2". In DB1 I created a plgpsql function fnTest(). My problem is inside fnTest() I need to check some tables in DB2! I've no idea how to do this. Usually when I make a function I only access tables/views/functions in the same database. I really don't know if this is possible. BTW, I googled my problem but did not see any topics on this. Need your expertise on this one guys...TIA! Marie Gezeala M. Bacuņo II IS Department Muramoto Audio-Visual Phils., Inc. MEPZ1, Lapu-Lapu City, Cebu, Philippines 6015 The person with the ultimate cachinnation possesses, thereby, the optimal cachinnation. --------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now --0-1584588277-1076662615=:67415 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Hi Guys!
 
I have 2 database namely "DB1" and "DB2".
 
In DB1 I created a plgpsql function fnTest().
 
My problem is inside fnTest() I need to check some tables in DB2! I've no idea how to do this. Usually when I make a function I only access tables/views/functions in the same database. I really don't know if this is possible.
 
BTW, I googled my problem but did not see any topics on this.
 
Need your expertise on this one guys...TIA!


Marie Gezeala M. Bacuņo II
IS Department
Muramoto Audio-Visual Phils., Inc.
MEPZ1, Lapu-Lapu City, Cebu, Philippines 6015

The person with the ultimate cachinnation possesses, thereby, the optimal cachinnation.


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now --0-1584588277-1076662615=:67415-- From gibsonm@cromwell.co.uk Fri Feb 13 09:30:00 2004 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3F472D1CACB for ; Fri, 13 Feb 2004 09:30:00 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 00850-10 for ; Fri, 13 Feb 2004 05:30:00 -0400 (AST) Received: from crommail.cromwell-tools.co.uk (host217-40-164-180.in-addr.btopenworld.com [217.40.164.180]) by svr1.postgresql.org (Postfix) with ESMTP id 2D3ACD1C515 for ; Fri, 13 Feb 2004 05:29:57 -0400 (AST) Message-ID: <402C994F.8030209@cromwell.co.uk> Date: Fri, 13 Feb 2004 09:30:55 +0000 From: Mark Gibson MIME-Version: 1.0 To: =?ISO-8859-1?Q?Gezeala_=27Eyah=27_Bacu=F1o_II?= Cc: pgsql-php@postgresql.org Subject: Re: How To Connect to another Database inside a plpgsql function References: <20040213085655.67695.qmail@web41408.mail.yahoo.com> In-Reply-To: <20040213085655.67695.qmail@web41408.mail.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/30 X-Sequence-Number: 2578 Gezeala 'Eyah' Bacuņo II wrote: > Hi Guys! > > I have 2 database namely "DB1" and "DB2". > > In DB1 I created a plgpsql function fnTest(). > > My problem is inside fnTest() I need to check some tables in DB2! I've > no idea how to do this. Usually when I make a function I only access > tables/views/functions in the same database. I really don't know if > this is possible. > Take a look at contrib/dblink, it allows cross database queries like this: SELECT * FROM dblink('host=myhost dbname=DB1 user=me', 'SELECT col1, col2, col3 FROM mytable') AS t (col1 integer, col2 text, col3 real); -- Mark Gibson Web Developer & Database Admin Cromwell Tools Ltd. Leicester, England. From gezeala25@yahoo.com Mon Feb 16 01:51:15 2004 X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D7D88D1DAA9 for ; Mon, 16 Feb 2004 01:51:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 51417-06 for ; Sun, 15 Feb 2004 21:50:54 -0400 (AST) Received: from web41402.mail.yahoo.com (web41402.mail.yahoo.com [66.218.93.68]) by svr1.postgresql.org (Postfix) with SMTP id F0AD5D1B4C0 for ; Sun, 15 Feb 2004 21:50:50 -0400 (AST) Message-ID: <20040216015054.62055.qmail@web41402.mail.yahoo.com> Received: from [203.177.72.130] by web41402.mail.yahoo.com via HTTP; Mon, 16 Feb 2004 01:50:54 GMT Date: Mon, 16 Feb 2004 01:50:54 +0000 (GMT) From: =?iso-8859-1?q?Gezeala=20'Eyah'=20Bacu=F1o=20II?= Subject: Re: How To Connect to another Database inside a plpgsql function To: Manuel Cabido Cc: pgsql-php@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-639861131-1076896254=:61514" Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.4 tagged_above=0.0 required=5.0 tests=FROM_ENDS_IN_NUMS, HTML_FONTCOLOR_BLUE, HTML_FONTCOLOR_RED, HTML_FONTCOLOR_UNSAFE, HTML_MESSAGE X-Spam-Level: * X-Archive-Number: 200402/37 X-Sequence-Number: 2585 --0-639861131-1076896254=:61514 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sir, I would really appreciate it if you can please expound more on how to issue a "connect" inside a plpgsql function?? Daghang Salamat sa iyong prompt reply.. I apologize for the late reply kase wala kaming work last saturday. BTW, I'm not that good in bisaya that's why combination ng bisaya, tagalog and english ang reply ko ;) Manuel Cabido wrote: Hi Eyah, Try daw ug issue ug "connect" to db2 within your procedure in db1. Manny Marie Gezeala M. Bacuņo II IS Department Muramoto Audio-Visual Phils., Inc. MEPZ1, Lapu-Lapu City, Cebu, Philippines 6015 The person with the ultimate cachinnation possesses, thereby, the optimal cachinnation. --------------------------------- Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now --0-639861131-1076896254=:61514 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
Sir, I would really appreciate it if you can please expound more on how to issue a "connect" inside a plpgsql function??
 
Daghang Salamat sa iyong prompt reply..
 
I apologize for the late reply kase wala kaming work last saturday.

BTW, I'm not that good in bisaya that's why combination ng bisaya, tagalog and english ang reply ko ;)

Manuel Cabido <manny@tinago.msuiit.edu.ph> wrote:
Hi Eyah,

Try daw ug issue ug "connect" to db2 within your procedure in db1.

Manny



Marie Gezeala M. Bacuņo II
IS Department
Muramoto Audio-Visual Phils., Inc.
MEPZ1, Lapu-Lapu City, Cebu, Philippines 6015

The person with the ultimate cachinnation possesses, thereby, the optimal cachinnation.


Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now --0-639861131-1076896254=:61514--