Newbie Questions

From: Tim Pushor <timp(at)crossthread(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Newbie Questions
Date: 2004-09-13 19:38:11
Message-ID: 4145F723.2090004@crossthread.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all,

I have an application that for a very specific reason will generate a
row of data that I want to put into a database. One problem is that I
don't know if this data already exists in the database, so should be
performed as an UPDATE, or doesn't and should be performed as an INSERT.
A previous list post touched on a possible solution (trying an UPDATE
and if the rows affected was 0 doing an INSERT). I have a couple
questions regarding this. To further comlicate things, the data is not
normalized. I would like to be able to also add logic to normalize the
data before adding it to the database.

I am good at perl, so I have been looking at the documentation around
PL/Perl.

My questions are:

1) Am I able to somehow do this UPDATE / check rows affected from perl,
or is there a better way (like call a PL/pgSQL function from perl
somehow? is this possible?)

2) Is PL/Perl robust enough (I suppose using DBD::PgSPI) to do what I
want? Am I going down the wrong path?

Thanks for any and all advice!
Tim

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2004-09-13 19:40:21 Re: nextval() clarification
Previous Message Sandip Bhattacharya 2004-09-13 19:08:58 Re: nextval() clarification