On 06/07/2013 10:11 AM, P.V.Anthony wrote:
> Hi,
> 
> I am about to try and make the virtual user table in postgresql database 
> without constrains so that multiple users can use one userID.
> 
> Before I do that, I need to delete the unnecessary users and their data.
> 
> Has anyone got the sql commands to delete a user and all their data in 
> the dspam database?
> 
> I am not an expert. Did so research in the internet. Here is what I got. 
> Does this look right?
> 
> Stop the smtp server so that no emails comes in until the dspam database 
> is cleaned.
> 
> Then run the following commands for the user that need to be deleted.
> 
> DELETE FROM dspam_signature_data WHERE uid = [uid_number];
> 
> DELETE FROM  dspam_token_data WHERE uid = [uid_number];
> 
> DELETE FROM  dspam_stats WHERE uid = [uid_number];
> 
> DELETE FROM  dspam_preferences WHERE uid = [uid_number];
> 
> DELETE FROM  dspam_virtual_uids WHERE uid = [uid_number];
> 
> Are the commards correct? Is the order of the commands correct?

This looks fine by me. Stopping the SMTPd shouldn't be needed, because
you won't cause conflicts with incoming mail (unless you receive mail
for the user you are deleting data for, but then you wouldn't be
deleting his/her data, right?)

If you're worried about data inconsistency, use a transaction:
http://www.postgresql.org/docs/9.2/static/tutorial-transactions.html

--
Tom

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Dspam-user mailing list
Dspam-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspam-user

Reply via email to