Re: [SQL] Inserting into table only if the row does not already

2004-10-16 Thread C. Bensend
> Gee, now I have images of late-night advertisements for bofh-porn video > tapes > of Cron Jobs Gone Wild(tm) dancing through my head... thanks. Wow. THERE'S something I didn't need before hitting the sack. ;) Benny -- "Even if a man chops off your hand with a sword, you still have two nic

Re: [SQL] Inserting into table only if the row does not already

2004-10-16 Thread Greg Stark
"C. Bensend" <[EMAIL PROTECTED]> writes: > The risk of a cron gone wild is acceptable to me at this moment. Gee, now I have images of late-night advertisements for bofh-porn video tapes of Cron Jobs Gone Wild(tm) dancing through my head... thanks. -- greg ---(end of b

Re: [SQL] Inserting into table only if the row does not already

2004-10-16 Thread C. Bensend
> Even cron'd scripts can run amok. Lock files are great as a CYA > measure even if you're relatively certain there will be no opportunity > for one copy to step on the next. Yes, you are absolutely correct, of course. :) I should be more specific - I'm working on a personal project, and I'm no

Re: [SQL] Inserting into table only if the row does not already

2004-10-16 Thread Steven Klassen
* C. Bensend <[EMAIL PROTECTED]> [2004-10-15 08:14:51 -0500]: > Concurrency shouldn't be an issue - this is a perl script running > from cron. The only concurrency that will ever happen is if I'm a > bonehead and I run the script manually right as cron kicks off > another copy. Even cron'd script

Re: [SQL] Inserting into table only if the row does not already

2004-10-15 Thread C. Bensend
> You just have to put it in the select list as a constant. If you're > feeling > generous to the next programmer to read it you could put "AS column1" > after > each one, but the column name doesn't actually have to match the column > you're > inserting into. Sweet GOD, I hope no one ever has to

Re: [SQL] Inserting into table only if the row does not already exist.

2004-10-14 Thread Greg Stark
"C. Bensend" <[EMAIL PROTECTED]> writes: > INSERT INTO table ( column1, column2, column3 ) >SELECT column1, column2, column3 >WHERE NOT EXISTS ( > SELECT column1, column2, column3 FROM table WHERE > column1 = $column1 AND > column2 = $column2 AND > column3

[SQL] Inserting into table only if the row does not already exist.

2004-10-14 Thread C. Bensend
Hey folks, I am inserting data into a table with a three-column primary key (the table is only three columns). The rows I'm trying to insert may very well be duplicates of ones already in the table, so I would like to have PostgreSQL handle the insert and possible error resulting from dup dat