Re: [GENERAL] INSERT only unique records

2009-07-12 Thread Sam Mason
On Fri, Jul 10, 2009 at 01:32:40PM -0700, Mark Felegyhazi wrote: > I'm learning Postgresql and trying to inserts only new entries in a > table and skips duplicates. I know this is a recurrent question, but > maybe you could point out what I'm doing wrong in this specific case. > To avoid duplicate

Re: [GENERAL] INSERT only unique records

2009-07-12 Thread Craig Ringer
On Fri, 2009-07-10 at 13:32 -0700, Mark Felegyhazi wrote: > 1. put a unique constraint on num in to_t > -> problem: the first violation breaks the subquery and the remaining records > are never inserted - I don't know how to catch the error in subqueries > > 2. create the following insert rule:

[GENERAL] INSERT only unique records

2009-07-11 Thread Mark Felegyhazi
Hey guys, I'm learning Postgresql and trying to inserts only new entries in a table and skips duplicates. I know this is a recurrent question, but maybe you could point out what I'm doing wrong in this specific case. Initially, I have two tables: from_t and to_t (empty); mydb=> select * from