Psql could not connect to server: No such file or directory, 5432 error?

I’m trying to run psql on my Vagrant machine, but I get this error: psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”? Note: Vagrant 1.9.2 Box: ubuntu/trusty64, https://atlas.hashicorp.com/ubuntu/boxes/trusty64 EDIT Commands I’ve used in order to install and run postgres: … Read more

PostgreSQL: role is not permitted to log in

I have trouble connecting to my own postgres db on a local server. I googled some similar problems and came up with this manual https://help.ubuntu.com/stable/serverguide/postgresql.html so: pg_hba.conf says: # TYPE DATABASE USER ADDRESS METHOD # “local” is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 … Read more

Truncating all tables in a Postgres database

I regularly need to delete all the data from my PostgreSQL database before a rebuild. How would I do this directly in SQL? At the moment I’ve managed to come up with a SQL statement that returns all the commands I need to execute: SELECT ‘TRUNCATE TABLE ‘ || tablename || ‘;’ FROM pg_tables WHERE … Read more

Change type of varchar field to integer: “cannot be cast automatically to type integer”

I have a small table and a certain field contains the type “character varying“. I’m trying to change it to “Integer” but it gives an error that casting is not possible. Is there a way around this or should I just create another table and bring the records into it using a query. The field … Read more

Tools to generate database tables diagram with PostgreSQL? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 7 years ago. Improve this question Are there any free tools to … Read more