comparison database/schema/messages.sql @ 42:e1017d556437

add unique indexes on number_in_pr
author David A. Holland
date Sun, 15 Jun 2014 18:16:12 -0400
parents 44c1509055c7
children 36d91dfe017f
comparison
equal deleted inserted replaced
41:81851564f552 42:e1017d556437
47 mimetype text not null, 47 mimetype text not null,
48 body text not null 48 body text not null
49 ) 49 )
50 WITHOUT OIDS; 50 WITHOUT OIDS;
51 51
52 -- Create an index for number_in_pr both to enforce uniqueness and
53 -- to enable lookup.
54 CREATE UNIQUE INDEX ON messages (pr, number_in_pr);
55 -- XXX: does this work?
56 CREATE UNIQUE INDEX ON
57 SELECT messages.pr, attachments.number_in_pr
58 FROM messages, attachments
59 WHERE messages.id = attachments.msgid
60 ;