Re: [GENERAL] Using hashtext and unique constraints together

2007-12-12 Thread Daniel Verite
Mason Hale wrote: > The problem I need help with is guaranteeing uniqueness of the URL on > insert, with a non-unique index on hashtext(url) and *without* creating a > unique index on page(url). > > I'm thinking that an insert trigger that ensures (SELECT count(*) FROM page > WHERE hashte

Re: [GENERAL] Using hashtext and unique constraints together

2007-12-12 Thread Peter Childs
On 11/12/2007, Mason Hale <[EMAIL PROTECTED]> 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,

Re: [GENERAL] Using hashtext and unique constraints together

2007-12-11 Thread Mason Hale
I recently discovered the hashtext() function, and I'm interested in using > it to reduce the size of one of the biggest indexes in my database. > ... The problem with either MD5 or hashtext() is that neither can guarantee > unique output even if the inputs are all unique. > ... > > The problem I