Alternate output format for psql

I just needed to spend more time staring at the documentation. This command: \x on will do exactly what I wanted. Here is some sample output: select * from dda where u_id=24 and dda_is_deleted=’f’; -[ RECORD 1 ]——+—————————————————————————————————————————————————————————————————————- dda_id | 1121 u_id | 24 ab_id | 10304 dda_type | CHECKING dda_status | PENDING_VERIFICATION dda_is_deleted | … Read more

Where does PostgreSQL store the database?

To see where the data directory is, use this query. show data_directory; To see all the run-time parameters, use show all; You can create tablespaces to store database objects in other parts of the filesystem. To see tablespaces, which might not be in that data directory, use this query. SELECT *, pg_tablespace_location(oid) FROM pg_tablespace;

Connecting to Postgresql in a docker container from outside

You can run Postgres this way (map a port): docker run –name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres So now you have mapped the port 5432 of your container to port 5432 of your server. -p <host_port>:<container_port> .So now your postgres is accessible from your public-server-ip:5432 To test: Run the postgres database (command above) … Read more

How to log PostgreSQL queries?

In your data/postgresql.conf file, change the log_statement setting to ‘all’. Edit Looking at your new information, I’d say there may be a few other settings to verify: make sure you have turned on the log_destination variable make sure you turn on the logging_collector also make sure that the log_directory directory already exists inside of the … Read more

“use database_name” command in PostgreSQL

When you get a connection to PostgreSQL it is always to a particular database. To access a different database, you must get a new connection. Using \c in psql closes the old connection and acquires a new one, using the specified database and/or credentials. You get a whole new back-end process and everything.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)