How to execute *.sql file using psql
Is this what you mean? \i e:/myFolder/index.sql;
Is this what you mean? \i e:/myFolder/index.sql;
I think the solution to add following to .psqlrc is far from perfection \set ON_ERROR_STOP on there exists much more simple and convenient way – use psql with parameter: psql -v ON_ERROR_STOP=1 better to use also -X parameter turning off .psqlrc file usage. Works perfectly for me p.s. the solution found in great post from … Read more
Basically correct. The important difference is that SET is an SQL command while the other two are psql meta-commands – indicated by the leading \. SET is an SQL command to change run-time parameters. It is executed on the server and has nothing to do with psql per se. \set is a psql meta-command: Sets … Read more
For current versions of PostgreSQL and pgAdmin, the “Guru” dialog warning has a “Fix it!” button or command. Use it. If there’s no “Fix it!” then we can use the Unix command line as follows. This is for PostgreSQL 9.1. Older versions do it differently. PostgresSQL docs are here: download adminpacks 8.4. adminpack functions 9.1. … Read more
Keep reading, the best options come last. But let’s clarify a couple of things first. Only silence the password request If your issue is only the password prompt, you can silence it. I quote the manual here: -w –no-password Never issue a password prompt. If the server requires password authentication and a password is not … Read more
The psql binary for Postgres.app is inside the application bundle and you’ll have to add the appropriate directory to your PATH. From the fine manual: Configure your $PATH Postgres.app includes many command line tools. If you want to use them, you must configure the $PATH variable. If you are using bash (default shell on OS … Read more
Three possible causes: One or more lines of your file has only 4 or fewer space characters (your delimiter). One or more space characters have been escaped (inadvertently). Maybe with a backslash at the end of an unquoted value. For the (default) text format you are using, the manual explains: Backslash characters (\) can be … Read more
You don’t run some psql.exe file, but the file C:\Program Files\PostgreSQL\10\scripts\runpsql.bat , for example programmatically, e.g. from AHK: run, “C:\Program Files\PostgreSQL\10\scripts\runpsql.bat” Then you get a generic Windows command window which asks you the right questions (see above) and, when answered correctly, gives you the psql command prompt.
When you display the psql online help by entering \? you can see: Connection \c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo} connect to new database (currently “postgres”) So you need to use: \c shorturl shorturl
Solution for me was simply using host.docker.internal instead of localhost in your connection string. https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/225