Database accesss using plperl

Started by Robert Fitzpatrickalmost 22 years ago6 messagesgeneral
Jump to latest
#1Robert Fitzpatrick
robert@webtent.com

I have plperl installed my PostgreSQL 7.4.2 server, but from what I
understand in chapter 39.3 of the docs, you cannot access the databases
without DBD::PgSPI. According to the readme for that module, it will
only run on the untrusted plperlu.

Is this the only way to run queries (SELECT, INSERT, UPDATE) using
plperl?

What are the consequences and things to look out for when running
untrusted languages?

--
Robert

#2Paul Thomas
paul@tmsl.demon.co.uk
In reply to: Robert Fitzpatrick (#1)
Re: Database accesss using plperl

On 16/06/2004 21:27 Robert Fitzpatrick wrote:

I have plperl installed my PostgreSQL 7.4.2 server, but from what I
understand in chapter 39.3 of the docs, you cannot access the databases
without DBD::PgSPI. According to the readme for that module, it will
only run on the untrusted plperlu.

Is this the only way to run queries (SELECT, INSERT, UPDATE) using
plperl?

Are you talking about writing functions/stored procedures in PERL or
accessing the database from a PERL program because what you have read is
specific to functions/stored procedures. (sorry for the bad/absent
punctuation but I've just come back from the pub after a generous quantity
of Old Speckled Hen)

-- 
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for 
Business             |
| Computer Consultants         | 
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+
#3Robert Fitzpatrick
robert@webtent.com
In reply to: Paul Thomas (#2)
Re: Database accesss using plperl

On Wed, 2004-06-16 at 19:05, Paul Thomas wrote:

On 16/06/2004 21:27 Robert Fitzpatrick wrote:

I have plperl installed my PostgreSQL 7.4.2 server, but from what I
understand in chapter 39.3 of the docs, you cannot access the databases
without DBD::PgSPI. According to the readme for that module, it will
only run on the untrusted plperlu.

Is this the only way to run queries (SELECT, INSERT, UPDATE) using
plperl?

Are you talking about writing functions/stored procedures in PERL or
accessing the database from a PERL program because what you have read is
specific to functions/stored procedures. (sorry for the bad/absent
punctuation but I've just come back from the pub after a generous quantity
of Old Speckled Hen)

I'm talking about writing PostgreSQL stored procedures using Perl that
access the database via queries (like pl/pgsql, maybe using DBI:Pg) for
SELECTs, INSERTs, UPDATEs, etc.

--
Robert

#4Paul Thomas
paul@tmsl.demon.co.uk
In reply to: Robert Fitzpatrick (#3)
Re: Database accesss using plperl

On 17/06/2004 15:56 Robert Fitzpatrick wrote:

[snip]
I'm talking about writing PostgreSQL stored procedures using Perl that
access the database via queries (like pl/pgsql, maybe using DBI:Pg) for
SELECTs, INSERTs, UPDATEs, etc.

Then DBI:PgSPI is what you want. AFAIK, DBI:Pg is for client-side only.

HTH

-- 
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for 
Business             |
| Computer Consultants         | 
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+
#5Jeff Eckermann
jeff_eckermann@yahoo.com
In reply to: Paul Thomas (#4)
Re: Database accesss using plperl
--- Paul Thomas <paul@tmsl.demon.co.uk> wrote:

On 17/06/2004 15:56 Robert Fitzpatrick wrote:

[snip]
I'm talking about writing PostgreSQL stored

procedures using Perl that

access the database via queries (like pl/pgsql,

maybe using DBI:Pg) for

SELECTs, INSERTs, UPDATEs, etc.

Then DBI:PgSPI is what you want. AFAIK, DBI:Pg is
for client-side only.

CommandPrompt has their own beta version of pl/perl,
which does database queries:

http://www.commandprompt.com/index.lxp?lxpt=22

This is certainly more actively developed than
DBI:PgSPI, which only ever was an experimental,
hackish workaround for the missing functionality.

HTH

--
Paul Thomas

+------------------------------+---------------------------------------------+

| Thomas Micro Systems Limited | Software Solutions
for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |

+------------------------------+---------------------------------------------+

---------------------------(end of
broadcast)---------------------------
TIP 2: you can get off all lists at once with the
unregister command
(send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)

__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail

#6Jeff Eckermann
jeff_eckermann@yahoo.com
In reply to: Paul Thomas (#4)
Re: Database accesss using plperl

Further to my earlier email: the CommandPrompt
pl/perl appears to handle trigger functions, but not
direct database access? Someone correct me if I'm
wrong.

So DBI:PgSPI may still be the only way to query the
database from a function using Perl. But are you sure
you really have to use Perl? If you are looking for a
language other than pl/pgsql to do queries from
functions, look at pl/tcl; I think that pl/python and
pl/ruby may also have some capability to do what you
want.

--- Paul Thomas <paul@tmsl.demon.co.uk> wrote:

On 17/06/2004 15:56 Robert Fitzpatrick wrote:

[snip]
I'm talking about writing PostgreSQL stored

procedures using Perl that

access the database via queries (like pl/pgsql,

maybe using DBI:Pg) for

SELECTs, INSERTs, UPDATEs, etc.

Then DBI:PgSPI is what you want. AFAIK, DBI:Pg is
for client-side only.

HTH

--
Paul Thomas

+------------------------------+---------------------------------------------+

| Thomas Micro Systems Limited | Software Solutions
for
Business |
| Computer Consultants |
http://www.thomas-micro-systems-ltd.co.uk |

+------------------------------+---------------------------------------------+

---------------------------(end of
broadcast)---------------------------
TIP 2: you can get off all lists at once with the
unregister command
(send "unregister YourEmailAddressHere" to
majordomo@postgresql.org)

__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail