Re: Problem with accesing Oracle from plperlu functionwhen using remote pg client.

From: Tomasz Olszak <tolszak(at)o2(dot)pl>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Problem with accesing Oracle from plperlu functionwhen using remote pg client.
Date: 2009-03-16 15:09:58
Message-ID: 7bb7b748.4586577f.49be6bc6.cb6e6@o2.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you for quick answer.
I understand, but when I print from plperlu function notices with result of `env` they're the same in both cases (from remote and local client).
So it looks like that plperlu function is executing from remote and local clients with the same set of environment variable.
So I don't have a clue how can I iron out this issue.
Dnia 16 marca 2009 15:27 Kenneth Marshall &lt;ktm(at)rice(dot)edu&gt; napisał(a):
On Mon, Mar 16, 2009 at 03:16:07PM +0100, Tomasz Olszak wrote:
&gt; Greetings to All!
&gt;
&gt; I've tried to find solution of my problem on other pg mailing lists but without bigger effect.
&gt;
&gt; I have a table A in PG. There is also table A in Oracle.
&gt; I want to import specific row from oracle to pg, so i create plperlu function
&gt;
&gt; CREATE OR REPLACE FUNCTION import.ora_a_row(a_id numeric)
&gt; RETURNS dok_za AS
&gt; $BODY$
&gt;
&gt; In IPL:
&gt; create_connection;
&gt; select all columns on oracle from table a where id = a_id;
&gt; returning tuple;
&gt;
&gt; $BODY$
&gt; LANGUAGE 'plperlu' VOLATILE;
&gt;
&gt; then i can use such function in pl/pgsql;
&gt; ....
&gt; DECLARE:
&gt; var A%ROWTYPE;
&gt; BEGIN;
&gt; ...
&gt; select * into var from import.ora_a_row(100);
&gt; END;...
&gt;
&gt; Like you see it's very, very convenient.
&gt;
&gt; And it works, but only when I make "select * from import.ora_a_row(100);" from psql?? on postgresql server(local client).
&gt; When I try to make that select in pgadmin or from remote machine I have tns error:
&gt;
&gt; TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at line 20
&gt;
&gt; I've tried with different postgresql versions and different perls, and different DBI Oracle packages, so i think pg or perl versions are not causes(Of course environment variables are propably set etc.). Oracle Base directory is about 1.6 gigabyte so I think it's full client(not instant).
&gt;
&gt; When I used PGADMIN 1.6 on postgresql server and left host editline blank(specifying only a pgport) it worked too.
&gt; But when I've written "localhost" as host it didn't work (the same with connecting "psql -h localhost -U user database" ).
&gt;
&gt; Anybody ancounter this kind of problem or maybe it's a bug in plperlu?
&gt;
&gt; I'll be grateful for any of Your help.
&gt;
&gt; Regards
&gt;
&gt; Tomasz
&gt;
This looks like an ENVIRONMENT variable problem. The server does not
run with the same set of settings as your psql program. I think that
it will work once you get those issues ironed out.
Good luck,
Ken

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2009-03-16 16:07:51 small but useful patches for text search
Previous Message Kenneth Marshall 2009-03-16 14:27:29 Re: Problem with accesing Oracle from plperlu function when using remote pg client.