Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-19 Thread Jasbinder Singh Bali
Thats exactly what I'm facing here. CREATE OR REPLACE FUNCTION test(int4) RETURNS int4 AS $BODY$ require "abc.pl" $BODY$ LANGUAGE 'plperlu' VOLATILE; SELECT test(23) doesn't run the script inside abc.pl that happens to be a some insert statements. Now, when i actually copy and paste t

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-18 Thread Harpreet Dhaliwal
Don't think it would work the way you are doing it. This way it would only work if you dealing with shared objects in C where in you dynamically load the shared object and then call a specific function of that shared object. Lately i tried the following for you but it doesn't execute the Insert s

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-18 Thread Jasbinder Singh Bali
Lately i've been able to user 'require' command successfully and the script was pretty straight forward and simple. I had to play around with @INC. Moving forward, I have another question here, CREATE FUNCTION *funcname* (*argument-types*) RETURNS *return-type* AS require " abc.pl" $$ LANGUAG

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-17 Thread Jasbinder Singh Bali
I'm kind of confused how this require thing would actually work because I tried testing it at my end at its really not working with postgres. I'm sure there is some fundamental mistake. I have to do the following: I have a perl file and need to call and use full functionaily of this perl file i

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread Harpreet Dhaliwal
so my syntax is correct? just wondering if there's some fundamental mistake in it ~Harpreet On 1/16/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Harpreet Dhaliwal" <[EMAIL PROTECTED]> writes: > I was just wondering if one could use something like this > CREATE FUNCTION *funcname* (*argument-types*

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread Tom Lane
"Harpreet Dhaliwal" <[EMAIL PROTECTED]> writes: > I was just wondering if one could use something like this > CREATE FUNCTION *funcname* (*argument-types*) RETURNS *return-type* AS $$ > require "abc.pl" > $$ LANGUAGE plperl; You'd have to use plperlu, since "require" isn't considered a truste

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread Harpreet Dhaliwal
I was just wondering if one could use something like this CREATE FUNCTION *funcname* (*argument-types*) RETURNS *return-type* AS $$ require "abc.pl" $$ LANGUAGE plperl; To include abc.pl here, how is the path of abc.pl specified. Also, just wondering if the structure of above function is cor

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread John DeSoi
I assume your choices are to include the entire script in a PostgreSQL function or simply create a small stub function that calls a function you have loaded with use or require (as mentioned by the other poster). But either way, you have to create a function so you can tell PostgreSQL what

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread Jasbinder Singh Bali
So there is nothing called dynamic loading of perl code in postgres. I'll have to include the whole perl script in the postgres function you mean? Thanks, Jas On 1/16/07, John DeSoi <[EMAIL PROTECTED]> wrote: Assuming you have pl/perl support compiled into PostgreSQL, just use CREATE FUNCTION:

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread John DeSoi
Assuming you have pl/perl support compiled into PostgreSQL, just use CREATE FUNCTION: http://www.postgresql.org/docs/8.2/interactive/plperl-funcs.html On Jan 16, 2007, at 9:24 AM, Jasbinder Singh Bali wrote: Actually I want to load my perl code in postgres function. How would i do that? I

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread Jasbinder Singh Bali
TECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jasbinder Singh Bali Sent: Tuesday, January 16, 2007 8:07 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Dynamic loading of Perl Code in Postgres functions Hi, I have some perl code that I need to load dynamically in my postgres function. How ca

Re: [GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread Adam Rich
8:07 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Dynamic loading of Perl Code in Postgres functions Hi, I have some perl code that I need to load dynamically in my postgres function. How can this be accomplished? I can do it in C using shared objects but don't know how would the same

[GENERAL] Dynamic loading of Perl Code in Postgres functions

2007-01-16 Thread Jasbinder Singh Bali
Hi, I have some perl code that I need to load dynamically in my postgres function. How can this be accomplished? I can do it in C using shared objects but don't know how would the same work with perl. Is there anything like shared objects in Perl or something. Thanks, Jas