Questions tagged [psql]
The psql tag has no usage guidance.
25 questions
0
votes
0
answers
455
views
I installed Postgresql. While trying to create user in psql, I messed up the configuration settings. Now, I can't even uninstall or install completely
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://apt.postgresql.org/pub/repos/apt jammy-pgdg InRelease:...
2
votes
0
answers
4k
views
How to manually uninstall PGAdmin4 from macOS?
I have tried removing manually by removing PGAdmin4 from my applications folder. I also followed a few steps from this post here. To my surprise some of the files existed and I was able to remove them....
0
votes
3
answers
221
views
Import psql dump without change in pg_hba.conf?
For some time I've been working on an install script for Tryton ERP on Linux systems. Meanwhile, most things are working, but I do not get around one challenge:
I need to provide the option to import ...
1
vote
0
answers
423
views
PostgreSQL sum function resurns different result when run multiple of times with psql
I have this query :
SELECT SUM(median) FROM my_table WHERE id = 100
-- median is of type float4
When I run from psql, it returns slightly different result for multiple of runs (For example 1000.08, ...
1
vote
1
answer
2k
views
psql command not taking password from .pgpass file
psql -U postgres -h 127.0.0.1 postgres
I am using the above command to connect to the postgres running on my system. It asks for password
Whereas I have setup .pgpass file in the current directory ...
0
votes
1
answer
945
views
Reduce the permission of a file in linux
psql -h 127.0.0.1 throwing this error :
.pgpass has group or world access; permissions should be u=rw (0600) or less
How do I reduce the permissions currently it shows : -rwxrwxrwx
1
vote
1
answer
2k
views
bash - passing an sql query as an argument to psql
I have the following SQL query that executes correctly in the psql shell:
SELECT c.component_name AS "Component",
c.component_version_name AS "Component Version",
c....
3
votes
2
answers
437
views
Viewing wide terminal output in tmux
I enjoy using psql with Tmux and Vim, using Vim to edit my queries and send them to psql in another Tmux pane. This is a fantastic workflow, far superior to a GUI like DBeaver in my opinion, but:
It ...
1
vote
1
answer
184
views
Is there an equivalent of .ssh/config for use with psql?
In the .ssh/config file (at least that's the usual default location), I can define hostname, username, port, etc. for ssh connections and store it with an easy to use name. That allows me to call ssh ...
1
vote
1
answer
109
views
Why do I get error "/var/lib/pgsql/.role.sh: not found" from postgres in docker?
I have PostgreSQL running in Docker. The host system is Ubuntu 18.04.3. Every time I execute some SQL in PostgreSQL I get
/var/lib/pgsql/.role.sh: not found
Does anyone know why this is or at least ...
-2
votes
1
answer
220
views
All my tables inserted with a .sql file are gone when I close a session in Postgres
So I'm new to psql so sorry for the noob question. Not sure if relevant but I'm using Ubuntu 19.04 installed on a USB stick with persistent memory (used mkdisk). Everything works fine but I have ...
0
votes
1
answer
1k
views
i can not connect to psql
i typed psql and it's show 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/...
1
vote
1
answer
2k
views
Can't create extension orafce in Postgresql
my os is redhat 7.3 and I am trying to install orafce to postgresql with psql version 9.2 and server version 9.6. Firstly, i try to install via the script orafce downloaded on github but after reading ...
1
vote
1
answer
414
views
Force transactions in psql
When I use the psql console, is it possible to force any inserts/updates/deletes to be run in a transaction? Or do I always have to explicitly start every command with 'BEGIN'?
2
votes
1
answer
16k
views
-bash: psql: command not found
I'm on a Mac 10.11 running psql -h localhost -U monitor -W postgres and I kept getting
-bash: psql: command not found
This is what I have in my paths.
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/...
1
vote
1
answer
869
views
Run shell and check port of specific postgresql version in ubuntu
Several versions of postgresql (9.3, 9.4 and 9.5) on a server with different ports and I want to start the shell of a specific one. If I run the shell:
psql
It returns:
psql (9.5.0, server 9.3.10)
...
3
votes
1
answer
683
views
pgAdmin III writes files with junk in them, which causes PSQL to fail
I encountered the dilemma of needing to run some psql console commands because a colleague needed to use psql's \i directive in a saved script to execute additional SQL-statements from another file, ...
4
votes
0
answers
890
views
Can't tab complete in psql
For some reason, tab-completion isn't working in psql on my Mac. I can tab complete table and field names just fine in Ubuntu, but pressing TAB fails to work in Mac OS X.
I can successfully use my Up/...
1
vote
1
answer
426
views
psql ignores my PAGER variable
I want to use less as my default pager. Therefore I have PAGER=less in my .bashrc. It's sourced properly:
$ echo $PAGER
less
However, psql still uses more if I call it with psql. BUT: If I call it ...
2
votes
1
answer
2k
views
How to display server name in psql prompt
I have two servers running same PostgreSQL databases where one is production and one is development snapshot. It would be very handy for me if I could show the server name in the psql prompt (like ...
1
vote
1
answer
3k
views
Postgresql query within a bash script
We are having an issue with a postgresql bash query. The output of the query from the bash script add's additional quotes around the date. Please can you help me fix it?!
Script:
#!/bin/sh
...
0
votes
1
answer
537
views
Change how PSQL shows queries
This is a minor issue, but it's driving me nuts.
Anyways, on some of my servers I'm running PostgreSQL 8.4. When using PSQL (also 8.4), queries are shown with a less-like interface, which I'm quite ...
0
votes
1
answer
4k
views
How to change output pattern in shell?
I run the psql command from a Linux shell. The resulting output looks like a table:
Name Age
-----------------
John 24
But I would like to get the result with commas like ...
2
votes
1
answer
2k
views
(-bash: initdb: command not found) When installing postgres mac
I get the following error (-bash: initdb: command not found) in the terminal when trying to install postgres on my mountain lion mac osx?
Also, does any one have a good resource for installing ...
6
votes
3
answers
3k
views
To have Vim Psql's editor
I have a Fresh Ubuntu installation.
I have no personal dot-files active.
I run unsuccessfully \e file.sql in Psql, when I have the following in my .bashrc, since Nano opens instead of Vim
export ...