C. Bensend wrote: > > > Hey folks, > > I store all my userprefs and address books in PostgreSQL, and > I've run into a problem occasionally with the constraint suggested > in the documentation found at: > > http://www.squirrelmail.org/docs/admin/admin-5.html#db-backend > > It suggests creating the address table with the following > definition: > > CREATE TABLE "address" ( > "owner" varchar(128) NOT NULL, > "nickname" varchar(16) NOT NULL, > "firstname" varchar(128) NOT NULL, > "lastname" varchar(128) NOT NULL, > "email" varchar(128) NOT NULL, > "label" varchar(255) NOT NULL, > CONSTRAINT "address_pkey" PRIMARY KEY ("nickname", "owner") > ); > CREATE UNIQUE INDEX "address_firstname_key" ON "address" > ("firstname", "lastname"); > > Unfortunately, that unique index is too narrow - I cannot have more > than one user that defines an address with "Frank" and "Marshall" as > their names, for example. I would instead suggest a constraint > like so: > > CREATE UNIQUE INDEX "address_firstname_key" ON "address" ( "firstname", > "lastname", "owner", "email" ); > > This allows multiple users to have identical entries, which may > or may not fit your needs. It does mine. :) Having a four-column > unique index may produce index bloat on larger installations, I have > less than a thousand addresses in mine and it works great. > MySQL schema is closer to CREATE INDEX "address_firstname_key" ON "address" ( "firstname", "lastname"); Are you sure that those entries need something unique? -- View this message in context: http://old.nabble.com/Slight-modification-to-PostgreSQL-address-table-definition-tp29095696p29107241.html Sent from the squirrelmail-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first ----- squirrelmail-users mailing list Posting guidelines: http://squirrelmail.org/postingguidelines List address: squirrelmail-users@xxxxxxxxxxxxxxxxxxxxx List archives: http://news.gmane.org/gmane.mail.squirrelmail.user List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-users