>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> Laurent Martelli <laurent@aopsys.com> writes:
>> The pictures table is scanned, but it's not needed.
Tom> Yes it is. For example, if pictures is empty then the view
Tom> yields zero rows. Omitting the join to pictures could give a
Tom> different result.
Since Permission is like this:
CREATE TABLE permissions (
GroupID integer NOT NULL REFERENCES groups ON DELETE cascade,
PictureID integer NOT NULL REFERENCES pictures ON DELETE cascade,
UNIQUE (GroupID, PictureID));
if the pictures table is empty, so is permissions, because
permissions.PictureID references pictures.
--
Laurent Martelli
laurent@aopsys.com Java Aspect Components
http://www.aopsys.com/ http://jac.objectweb.org