Just a note for Windows users
I had a drama with psql (only \x commands worked -- probably self made)
At boot up this psql warning appeared
Warning console code page (437) differs from Window code page (1252)
I found the runsql.bat file and added
cmd.exe /c chcp 0437
to the top and saved it
When run the runsql.bat file reset the code page, returned
"Active code page 437",
got rid of the warning and psql began working (coincidence?)
The bat file and system particulars follow below.
Thanks all John Coffey
---------------------------------------------------------------------------------------------
Database
Instalation file postgresql-9.1.3-1-windows.exe
Postgresql =#SELECT version();
PostgreSQL 9.1.3, complied by Visual C++ build 1500, 32 bit
==========================
Operating System
Windows XP version 5.1 (build 2600.xpsp.080413-2111: Service Pack 3)
Copyright 2007
----------------------------------------------------
runsql.bat
@echo on
REM Coffey Set window codepage to legacy 437 to circumvent warning
REM Warning console code page (437) differs from Window code page (1252)
cmd.exe /c chcp 0437
REM PostgreSQL server psql runner script for Windows
REM Dave Page, EnterpriseDB
SET server=localhost
SET /P server="Server [%server%]: "
SET database=postgres
SET /P database="Database [%database%]: "
SET port=5432
SET /P port="Port [%port%]: "
SET username=postgres
SET /P username="Username [%username%]: "
for /f "delims=" %%a in ('chcp ^|find /c "932"') do @ SET CLIENTENCODING_JP=%%a
if "%CLIENTENCODING_JP%"=="1" SET PGCLIENTENCODING=SJIS
if "%CLIENTENCODING_JP%"=="1" SET /P PGCLIENTENCODING="Client Encoding [%PGCLIENTENCODING%]: "
REM Run psql
"C:\Program Files\PostgreSQL\9.1\bin\psql.exe" -h %server% -U %username% -d %database% -p %port%
pause