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