[GENERAL] Insert unique fails, still increments ID in a lookup table

2009-09-21 Thread Mark Felegyhazi
Hi, Could you please give me some hints how to optimize this in my DB? I have a main table and a lookup table as follows: create table main ( id bigserial primary key; item_id bigint references lookup (item_id); ); create table lookup ( item_id bigserial primary key; item_name text

[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