On Wed, Dec 01, 2004 at 10:48:40 -0800, Scott Frankel <[EMAIL PROTECTED]> wrote: > > 1. > CREATE TABLE names (the_id SERIAL PRIMARY KEY, the_name text); > CREATE UNIQUE INDEX uidx_thename ON names(the_name); > > vs. > > 2. > CREATE TABLE names (the_id SERIAL PRIMARY KEY, the_name text UNIQUE); > > > Is the UNIQUE constraint in the second solution merely short-hand for > the explicit > index declaration of the first solution? Or is there a functional > difference between > them that I should choose between?
Currently the only way to enforce a UNIQUE constraint is by using an index. So there isn't really much difference between the two. However, I think using the UNIQUE constraint provides better meaning than using an index for people who might look at your definitions later. ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly