среда, 9 ноября 2011 г.

PostgreSQL. How Disable All Constraints

Sometimes shit happens.
In my situation it was two plain-text SQL files. One of them contains DB schema and second with data.
I successfully create new DB and create DB schema using command:
psql -U my_user my_db < db_schema.sql
but the next steps gave many errors.
pg_restore didn’t want to read this format and psql didn’t want insert data because constraints were already turn on.
I did not find correct way for turn off all constraints in PosgressSQL. I found information about how disable triggers for specific table but not for all:
http://www.postgresql.org/docs/8.1/static/sql-altertable.html
After some experiments I found the next way which works for PostgreSQL v8.3.3:
Disable all triggers(run this sql command):
update pg_trigger set tgenabled='D' ;
Insert data:
psql -U my_user my_db < db_data.sql
Enable all triggers:
update pg_trigger set tgenabled='O' ;

четверг, 3 ноября 2011 г.

Using log4j into jboss

Good article about using log4j into jboss
http://www.mastertheboss.com/jboss-application-server/251-jboss-log4j-configuration.html?showall=1