[GENERAL] PG_RESTORE and database size

2006-01-27 Thread Marcus Couto



Here's a basic question.On working with 
backing up and restoringit seems like if I keep on doingit in a row, 
the backup file size keeps on increasing in size. It almost doubles in size for 
every backup/restore. I want the restore the backup to overwrite the database 
and not add to it. Is there another procedure I'm missing or a parameter I'm not 
using right with pg_restore and pg_dump? 

Thank you for any help.


[GENERAL] Triggers and Audit Trail

2005-12-29 Thread Marcus Couto



Hi all. I'm new with PostgreSQL and this is my 
first post, so easy on me... :)

I'm thinkingof using the native procedural 
language and triggers to keep an audit trail. Forediting changes, we only 
keepa log of the modified fields and we create a record for each modified 
value. The audit tablerecord holds 
informationlike user, date/time, table_name, field_name, old_value, 
new_value, type(delete, new, edit).I have a 
couple of questions:

Using triggers, is there a way to loop through the 
fields of the OLD and NEW records? I haven't 
found a generic way to get the field name and value that triggered the 
updateother than hard coding if statements to compare every field of the 
OLD and NEW records.

Another issue is how to keep track of the audit 
user since we share the same postgres user and our application keeps track of 
the actual current user locally. Is there some kind of way we can set the 
current user so that we'reable to read it from the trigger event? Other 
suggestions?

Thanks