On 26-02-14 22:29, Paul J Stevens wrote:
> On 26-02-14 20:58, Gray, Patrick wrote:
>> Would something like:
>> Delete from dbmail_headervalues where id not in(select headervalue_id from
>> dbmail_header);
>
> That situation should never occur if your schema is intact, since
> dbmail_header.headervalue_id references dbmail_headervalue.id with a
> cascading foreign key constraint.
Correction, your query is pretty much what is done in do_check_integrity.
You might test the first query in step 7:
SELECT hv.id FROM dbmail_headervalue hv
LEFT JOIN dbmail_header h ON hv.id = h.headervalue_id
WHERE h.headervalue_id IS NULL;
maybe it takes a long time, or maybe it returns a *lot* of rows.
--
________________________________________________________________
Paul J Stevens pjstevns @ gmail, twitter, github, linkedin
www.nfg.nl/[email protected]/+31.85.877.99.97
_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail