Questions tagged [psql]

psql is official postgresql client

psql is the official postgresql database client. It provides a command line interface (CLI), and it can be used to establish an interactive session with a postgresql database server and execute SQL queries. It can also be used to import an SQL file and execute it against one of the postgrseql DBs.

50 questions
2
votes
2 answers

postgres shell keeps hiding the information

When using psql, \d or select * from XXXX, after I exit and go back to shell, the information is not there and I need it to do the next command all the time. This is very very annoying. Is there any way to tell psql to always display what…
Dean Hiller
  • 911
  • 4
  • 15
  • 35
2
votes
1 answer

Monit "is alive" check of PostgreSQL tends to fail during a run of pg_dump, is there a better way?

I use pg_dump for my primary backup, once every three hours. I also use monit. When monit checks if PostgreSQL is alive during the pg_dump run, it sometimes times out, and restarts postgres. This results in failed backup. What to do? Move to…
Terry G Lorber
  • 667
  • 2
  • 9
  • 14
2
votes
2 answers

ssh connection interrupted while interactive psql running command--will command finish? Can I reconnect?

I was using interactive psql to run a reindex on one of our databases. Unfortunately, the ssh connection dropped while the reindex was still running and I had foolishly not put psql inside a screen window (I didn't realize how long it took!) Once I…
eulerz
  • 23
  • 2
2
votes
1 answer

PSQL error with restarting postgres in SSL

I set up server.crt, root.crt and servery.key in postgresql (using http://howtoforge.com/postgresql-ssl-certificates for instructions), set ssl = on and restarted the service successfully. However, as I test the connection with psql to see if it's…
2
votes
1 answer

Double port forwarding kubernetes + docker

Summary: I have a docker container which is running kubectl port-forward, forwarding the port (5432) of a postgres service running as a k8s service to a local port (2223). In the Dockerfile, I have exposed the relevant port 2223. Then I ran the…
Chayan Ghosh
  • 123
  • 1
  • 4
1
vote
0 answers

Why are psql commands in my script suddenly being killed by jenkins / hudson?

I have an existing jenkins job that kicks off a shell script to copy my prod environment into qa. We added a lot of data to prod (gzip dump went from 2gig to 15gig) and all of the sudden my jenkins jobs started failing. We are running postgres 9.5…
Ted
  • 11
  • 1
1
vote
3 answers

Why does psql attempt to connect with a different username when run from a Perl script

I have a bunch of Perl scripts that have recently stopped working. I have narrowed the problem down to this: when I connect to a postgresql database from a perl script, it attempts to use the wrong username and the connection fails. E.g. if I am…
mojones
  • 165
  • 1
  • 3
  • 8
1
vote
0 answers

parallize postgres queries with bash and psql?

I'm trying to run a series of postgres functions/stored-procedures that operate on separate tables in parallel using bash + psql as follows: psql -d samples_20160612_0616 -c "select insert_function('2016-6-14 20:00'::timestamp, '2016-6-14…
monkut
  • 255
  • 3
  • 13
1
vote
2 answers

Why doesn't "psql -U" work for me?

I'm just starting with Postgres. This is a fresh install of Postgres 9.5 on Ubuntu 14.04 LTS. I used the apt repo from: http://www.postgresql.org/download/linux/ubuntu/ The intro page…
fadedbee
  • 2,068
  • 5
  • 24
  • 36
1
vote
0 answers

psql: How to include comments in \d output

In PostgreSQL it is possible to add comments to table columns. These will appear in the psql output from the "extended describe" \d+ command, however they will not appear in the standard \d output. Is there a psql setting or default that can be…
Daniel Fortunov
  • 201
  • 3
  • 5
1
vote
1 answer

postgres server works on LAN but not WAN (connection refused)

I'm trying to set up a postgres server, but I cannot access it through the Internet. It works fine on my LAN. Server is just a desktop computer using Ubuntu 12.04 desktop. disclaimer: I am not planning to use this configuration permanently. …
buck
  • 111
  • 2
1
vote
1 answer

"distinct" query returning me multiple records

On executing the following query I am getting multiple records as result with each having id=10. If I am using distinct keyword, then I should get just one record. What could be the cause? "select distinct(id) from tablename where id="10"
Gautam Somani
  • 296
  • 3
  • 14
1
vote
1 answer

Cannot access psql after installing postgres

I installed postgresql via homebrew on my 10.7.3. The install seemed successful and I was able to start up the server. However when I try to access psql I get the following error: psql: FATAL: role "larson" does not exist In this case larson is my…
1
vote
1 answer

Using psql with two postgresql installations on Windows 7

I have installed two versions of Postgresql, 8.4 and 9.1. When I try to run psql it only picks up the previous psql version. For example, when I run the following line to connect to the database, ax_data: C:\Program Files…
celenius
  • 273
  • 1
  • 4
  • 17
0
votes
1 answer

I think I am unable to relock my postgres psql account

When I was setting up postgresql on linux, I was following a tutorial that I think had me change the postgres account password and I did not know any better. Please forgive my ignorance. When I type "psql postgres" it asks for a password and only…