While using perl to make some DBI calls to a PostgreSQL database, I realized that many's the time when I select data from a view, or use a function/stored procedure. Naturally, the functions/SPs are in SQL or PL/pgSQL, and the selection and final presentation of the data is handled by perl. Now, with some new advances in PL/Perl, -- a perl-based procedural language for PostgreSQL -- I started to think about Where Things Are Done.
Correlated subqueries lend themselves nicely to being rewritten into functions/SPs using PL/pgSQL, rather than downloading messy blocks of data into memory only to be subsequently discarded.
Regular expression processing is loved by perl. So perl might be used for data validation -- implemented in PL/Perl as a trigger, thereby letting the database handle the atomicity of the transaction; rather than validating in perl, using DBI to insert, using PL/pgSQL to verify, and then possibly roll the whole thing back across a span of different languages and routines.
It appears that where things are done is becoming less of a restriction and more of a personal choice, based on a number of factors unique to the individual problem domain's specific solution criteria.
So, which method/s would you use?
And why?
Contemplatively,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl, PostgreSQL, and Where Things Are Done
by perrin (Chancellor) on Jan 20, 2005 at 03:47 UTC | |
by grinder (Bishop) on Jan 20, 2005 at 08:47 UTC | |
|
Re: Perl, PostgreSQL, and Where Things Are Done
by rob_au (Abbot) on Jan 20, 2005 at 09:57 UTC | |
|
Re: Perl, PostgreSQL, and Where Things Are Done
by castaway (Parson) on Jan 20, 2005 at 11:41 UTC | |
|
Re: Perl, PostgreSQL, and Where Things Are Done
by zby (Vicar) on Jan 20, 2005 at 10:07 UTC | |
by rob_au (Abbot) on Jan 24, 2005 at 10:18 UTC | |
by bill_mcgonigle (Acolyte) on Jan 25, 2005 at 21:19 UTC |