Hi, I'm using Pg for bioinformatic work and I want to be able to insert, uniquely, biological sequences into a table returning the sequence id - this part is fine. However, if the sequence already exists in the table I want to return to id. At the moment it seems to me that I should do a SELECT id FROM table WHERE seq = '<sequence>'; and if that gives NULL then INSERT .... RETURNING id; But this seems long winded. Is there a better way to achieve what I want? thanks -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general