Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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 

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!

pgsql-novice by date

Next:From: Oliver ElphickDate: 2004-09-13 19:40:21
Subject: Re: nextval() clarification
Previous:From: Sandip BhattacharyaDate: 2004-09-13 19:08:58
Subject: Re: nextval() clarification

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group