Hi my database is setup as UTF-8 encoding. I use cmd (windows) and ssh to connect to my postgres database. In CMD all polish letters work fine (ś,ą,ż...). the problem is when I connect with my database by:
psql -U database;
then polish letters don't exist, and I do not know how, any ideas why?
ps. when I use PGAdmin polish letters work fine, but if is possible I prefer to use command line
Related
I am trying to import a pg_dump from a Linux machine called "dump.sql" into a windows machine that has PgAdmin4 that does not have psql working.
I keep getting this error message:
pg_restore: [archiver] input file appears to be a text format dump. Please use psql.
Any help is greatly appreciated.
You cannot do that.
One problem is the COPY FROM STDIN that you can find in an SQL dump, and the other is the \c command you will find in dumps created with -C.
Not sure if there are more problems, but these are definitely showstoppers.
Did you delete the psql executable?
I have not seen a Windows pgAdmin installation without a psql.exe so far.
I'm new to postgreSQL and I have a simple question:
I'm trying to create a simple script that creates a DB so I can later call it like this:
psql -f createDB.sql
I want the script to call other scripts (separate ones for creating tables, adding constraints, functions etc), like this:
\i script1.sql
\i script2.sql
It works fine provided that createDB.sql is in the same dir.
But if I move script2 to a directory under the one with createDB, and modify the createDB so it looks like this:
\i script1.sql
\i somedir\script2.sql
I get an error:
psql:createDB.sql:2: somedir: Permission denied
I'm using Postgres Plus 8.3 for windows, default postgres user.
EDIT:
Silly me, unix slashes solved the problem.
Postgres started on Linux/Unix. I suspect that reversing the slash with fix it.
\i somedir/script2.sql
If you need to fully qualify something
\i c:/somedir/script2.sql
If that doesn't fix it, my next guess would be you need to escape the backslash.
\i somedir\\script2.sql
Have you tried using Unix style slashes (/ instead of \)?
\ is often an escape or command character, and may be the source of confusion. I have never had issues with this, but I also do not have Windows, so I cannot test it.
Additionally, the permissions may be based on the user running psql, or maybe the user executing the postmaster service, check that both have read to that file in that directory.
Try this, I work myself to do so
\i 'somedir\\script2.sql'
i did try this and its working in windows machine to run a sql file on a specific schema.
psql -h localhost -p 5432 -U username -d databasename -v schema=schemaname < e:\Table.sql
I'm working in a centralized monitoring system on Windows 2008 R2, I have installed a PostgreSQL 9.3 to use psql from the command line.
When I try to access to some remote Postgres (an 8.4 in my principal case) I have an error with the encoding:
command:
psql.exe -h 192.168.114.12 -p 5432 -d db_seros_transaccion -U postgres -f script.sql
error:
psql: FATAL: la conversión entre WIN1252 y LATIN1 no está soportada
I try adding the sentence
SET client_encoding = 'UTF8';
in my script but the problem persist (and with other encodings too, like LATIN1 & WIN1252).
After googling it I found people that update some rows in the server to make the connection, and this is a problem to me.
Can anyone help me to make a connection using psql without an update? Is it possible?
Thanks a lot Craig Ringer, works, finally works! You are my new idool now!
The steps are:
open the cmd
SET PGCLIENTENCODING=utf-8
chcp 65001
psql -h your.ip.addr.ess -U postgres
Windows 10 / Windows server 2016 or later:
Open Windows Control Panel
Select Region (and Language)
Click Change system locale
Beta: Use Unicode UTF-8 for worldwide language support
Click OK
or
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"ACP"="65001"
"OEMCP"="65001"
"MACCP"="65001"
The PowerShell console and CMD will display Cyrillic correctly
As an option, try enter this command in psql :
postgres=# \! chcp 65001
65001 is equals UTF-8
1251 = WIN 1251
I have a UTF8 database and a UTF8 script to fill tables with data. However I want to run this script with psql -d instance -U user -f fillTables.sql. As my system has a Windows CP1252 encoding it looks like psql uses this to parse the file. I found this documentation and saw these backslash commands, but don't get it working
psql \encoding UTF8 -d instance -U user -f fillTables.sql
It looks like these are meant for starting psql and entering commands inside the psql console, right? How can I set different encoding for a batch processing of different files?
I got it working with export PGCLIENTENCODING=UTF8 (in cygwin, there is another syntax for windows), but would accept other answers if they can achieve the same with an option of psql.
I'm new to postgreSQL and I have a simple question:
I'm trying to create a simple script that creates a DB so I can later call it like this:
psql -f createDB.sql
I want the script to call other scripts (separate ones for creating tables, adding constraints, functions etc), like this:
\i script1.sql
\i script2.sql
It works fine provided that createDB.sql is in the same dir.
But if I move script2 to a directory under the one with createDB, and modify the createDB so it looks like this:
\i script1.sql
\i somedir\script2.sql
I get an error:
psql:createDB.sql:2: somedir: Permission denied
I'm using Postgres Plus 8.3 for windows, default postgres user.
EDIT:
Silly me, unix slashes solved the problem.
Postgres started on Linux/Unix. I suspect that reversing the slash with fix it.
\i somedir/script2.sql
If you need to fully qualify something
\i c:/somedir/script2.sql
If that doesn't fix it, my next guess would be you need to escape the backslash.
\i somedir\\script2.sql
Have you tried using Unix style slashes (/ instead of \)?
\ is often an escape or command character, and may be the source of confusion. I have never had issues with this, but I also do not have Windows, so I cannot test it.
Additionally, the permissions may be based on the user running psql, or maybe the user executing the postmaster service, check that both have read to that file in that directory.
Try this, I work myself to do so
\i 'somedir\\script2.sql'
i did try this and its working in windows machine to run a sql file on a specific schema.
psql -h localhost -p 5432 -U username -d databasename -v schema=schemaname < e:\Table.sql