Re: Using hashtext and unique constraints together - Mailing list pgsql-general

From Peter Childs
Subject Re: Using hashtext and unique constraints together
Date
Msg-id a2de01dd0712120009w298b7009qd1c3cf919b3881aa@mail.gmail.com
Whole thread Raw
In response to Using hashtext and unique constraints together  ("Mason Hale" <masonhale@gmail.com>)
List pgsql-general


On 11/12/2007, Mason Hale <masonhale@gmail.com> wrote:

I'm thinking that an insert trigger that ensures (SELECT count(*) FROM page WHERE hashtext(url) = hashtext(' http://www.postgresql.org') AND url = ' http://www.postgresql.org' ) = 0 won't work given MVCC, as two transactions could simultaneously insert the same url at the same time.


Why not so long as it also locks the table (share lock should be enough) but it could slow the table down if lots of transactions write to the table at once.

Regards

Peter.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: what is the date format in binary query results
Next
From: "Peter Childs"
Date:
Subject: Re: top posting