Postgresql -bash: psql: command not found
perhaps psql isn't in the PATH
of the postgres user. Use the locate command to find where psql is and ensure that it's path is in the PATH
for the postgres user.
psql: command not found Mac
You have got the PATH slightly wrong. You need the PATH to "the containing directory", not the actual executable itself.
Your PATH should be set like this:
export PATH=/Library/PostgreSQL/9.5/bin:$PATH
without the extra sql
part in it. Also, you must remove the spaces around the equals sign.
Keywords: Postgresql, PATH, macOS, OSX, psql
psql: command not found when running bash script in eclipse
I suspect that the Runtime
that is used to execute the script won't have the paths set correctly. Try using full paths for the commands in the script, and see if that works (you can find the full paths by running which createdb
and which psql
in the terminal).
Postgres psql not recognized as an internal or external command
Just an update because I was trying it on Windows 10 you do need to set the path to the following:;C:\Program Files\PostgreSQL\14\bin ;C:\Program Files\PostgreSQL\9.5\lib
PS : 14 is the current version, check whatever version you are on.
You can do that either through the CMD by using set PATH [the path]
or from my
computer => properties => advanced system settings=> Environment
Variables => System Variables
Then search for path.
Important: don't replace the PATHs that are already there just add one beside them as follows ;C:\Program Files\PostgreSQL\9.5\bin ;C:\Program Files\PostgreSQL\9.5\lib
Please note: On windows 10, if you follow this: computer => properties => advanced system settings=> Environment Variables => System Variables> select PATH, you actually get the option to add new row. Click Edit, add the /bin and /lib folder locations and save changes.
Then close your command prompt if it's open and then start it again
try psql --version
If it gives you an answer then you are good to go if not try echo %PATH%
and see if the path you set was added or not and if it's added is it added correctly or not.
Important note:
Replace 9.5 with your current version number. As of 2021, that is 13.
For 2022 is 14.
Syntax error in psql , command not get executed
You are trying to run psql
with \COPY
inside psql
session, thus you get an error in the second call, since psql
keyword does not exist in SQL. psql is an executable.
To follow the instructions from Timescale, you need to call the command directly in CMD. I.e, call:
psql -d test -c "\COPY test1 FROM C:\Users\DEGEJOS\Downloads\test.csv CSV"
If you are in C:\Users\DEGEJOS
as in your screenshoot, it will look like:
C:\Users\DEGEJOS\psql -d test -c "\COPY test1 FROM C:\Users\DEGEJOS\Downloads\test.csv CSV"
Columns combined when using `select ...pgp_sym_decrypt ()` from postgresql databse through Bash psql
I found the issue. The problem is you specified --field-separator
to "nothing" instead of a space. It should be --field-separator=" "
. This allowed the output of pgp_sym_decrypt()
to concatenate with note
. The username field however always had spaces probably since it has a fixed width of 30.
I also suggest that you reduce the number of row outputs to 1, and also enable "noglob" option when you're relying on word splitting. This can be done with set -f
. You can also use read
to get the needed fields. See How to split a string into an array in Bash?.
Related Topics
Crontab Run Every 15 Minutes Between Certain Hours
How to Launch a New Process That Is Not a Child of the Original Process
Performance Difference Between Ipc Shared Memory and Threads Memory
List Supported Ssl/Tls Versions for a Specific Openssl Build
Create New File But Add Number If Filename Already Exists in Bash
/Proc/$Pid/Maps Shows Pages with No Rwx Permissions on X86_64 Linux
Minimal Core Dump (Stack Trace + Current Frame Only)
One Command to Create and Change Directory
How Secure Is Storing Password with Git
How to Specify Filenames Within a Zip When Creating It on the Command Line from a Pipe
Simulate a Faulty Block Device with Read Errors
Identifying Received Signal Name in Bash
Differencebetween Pthread_Self() and Gettid()? Which One Should I Use
Device Tree Compiler Not Recognizes C Syntax for Include Files