Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pycharm run PostgreSQL script: Cannot run program "psql ": error=2, No such file or directory

Trying to execute SQL script in Pycharm using button "Execute SQL script" and get:

Error executing SQL script "/home/mike/PycharmProjects/db_pjct/DB/f_companies.sql". Details: Cannot run program "psql ": error=2, No such file or directory

DB Execution console:

Jan 14, 2017 3:47:11 PM: shedule_db / f_companies.sql - Executing command: psql --echo-all --host=localhost --port=5432 --dbname=shedulator --username=postgres -f "/tmp/DBN763311781346405195.sql"

Database runs on localhost. Statement execution in PyCahrm works well, no problem. Execution script from console also works well:

psql -h localhost -U postgres -d db_pjct -f /home/mike/PycharmProjects/db_pjct/DB/f_companies.sql

Where is my mistake?

like image 269
Михаил Веселков Avatar asked Oct 30 '22 14:10

Михаил Веселков


1 Answers

Found the answer

  1. right click on selected text and right click "execute SQL Script"

  2. A DB Navigator - Execute SQL script window opens up open the drop down in the [Cmd-Line interface] field and select "+"

2.1 -navigate to the psql folder (open a new terminal type in "which psql" to find your installation dir"; mine is at '/usr/bin/psql' )

execute selected text to your hearts content :)

p.s. don't forget to press the commit button because everything you do is run in a transaction space, and you need to click on commit to see changes in the db,

like image 148
Mickey Perlstein Avatar answered Jan 02 '23 19:01

Mickey Perlstein