On Fri, Feb 20, 2009 at 06:50:22AM -0800, David Fetter wrote: > On Thu, Feb 19, 2009 at 11:43:19PM +0000, Sam Mason wrote: > > On Tue, Feb 17, 2009 at 09:53:00AM -0800, David Fetter wrote: > > > user_name TEXT, -- unless length is an integrity constraint, use TEXT instead of VARCHAR. > > > > > > then later: > > > > > > CREATE UNIQUE INDEX unique_user_name_your_table > > > ON your_table(LOWER(TRIM(user_name))) > > > > > > You might also require that whitespace be treated in some > > > consistent way, one example of which is simply forbidding > > > whitespace in user_name at all. This you can do via CHECK > > > constraints or a DOMAIN. > > > > The reason behind this appears to be moving some of the checks into > > the database and away from the application. > > Since a useful database has *many* applications instead of "the" > application, I think this is an excellent move. Single Point of > Truth and all that. Oops, I think I failed to read your original message very well then. I failed to notice the "forbidding whitespace" comment even though I deliberately left it in. Doh! > > I don't think that either my nor David's is better in general, they > > apply to different situations. > > I don't even think they're *different* in general ;) No, they're not really are they. :) -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general