Questions tagged [psql]
24 questions
6
votes
3 answers
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 VISUAL=/usr/bin/vim
export EDITOR=/usr/bin/vim
export…
Léo Léopold Hertz 준영
- 5,686
- 12
- 68
- 115
4
votes
0 answers
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/Down arrow keys to navigate back and forth in…
mcandre
- 3,026
- 5
- 39
- 61
3
votes
1 answer
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, but I noticed that psql was choking on these files…
Seldom 'Where's Monica' Needy
- 260
- 2
- 9
3
votes
2 answers
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 doesn't take many columns for psql to be unable to…
LondonRob
- 405
- 7
- 27
2
votes
1 answer
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 this):
database_name@server_name >
Is there any…
Nemanja Boric
- 135
- 6
2
votes
1 answer
(-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 postgres, and setting it up? Working with bash and…
user630581
2
votes
1 answer
-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
/usr/local/pgsql/bin
code-8
- 416
- 2
- 8
- 23
1
vote
1 answer
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 with PAGER=less psql, psql does use less.
I have no…
musiKk
- 355
- 1
- 2
- 11
1
vote
1 answer
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
lastmonth=$(date -d "-1 month -$(($(date +%d)-1)) days"…
GuruFrog
- 56
- 1
- 4
1
vote
0 answers
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, 1001.02, ...)
The number of entries contributing…
Philippe
- 125
- 5
1
vote
1 answer
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 or scp without having to do all the tedious…
karpfen
- 141
- 6
1
vote
1 answer
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 what the .role.sh script is? The SQL code seem to…
Filip Sjöstrand
- 11
- 1
1
vote
1 answer
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 some topics about extension in postgresql, i…
MaximusPrime
- 11
- 2
1
vote
1 answer
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'?
mawaldne
- 2,636
- 1
- 13
- 6
1
vote
1 answer
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)
Type "help" for help.
postgres=#
I think that I…
Joost Döbken
- 113
- 5