PostgreSQL Debugging

Enable SQLi logs

When we want to access queries which are transmitted to SQL database by application sometimes we have to modify the SQL file.

For example when it comes to PostgreSQL we are able to modify postgresql.conf file which includes the log_statement property. In order to show all logs that are going to database we configure it in the following way:

log_statement = 'all' # none, ddl, mod, all

How to restart the service:

Restarting web applications

Logs location

When it comes to PostgreSQL you can find logs in the pgsql_log directory. When it comes to other databases you have to do your own research through web search.

Running commands against SQL database with GUI

Sometimes you are able to execute queries on the application SQL server with provided credentials. In that case pgadmin software can help you.

Running commands against SQL database from terminal

Connect to database:

List tables + relations:

Quit:

Last updated