ZJAY
ZJAY

Reputation: 2837

psql: FATAL: invalid value for parameter "client_encoding": "WIN1252"

I am using psql with Redshift. Unfortunately, Redshift is uses PostgreSQL 8.0.2. So when I downloaded the latest version of PostgreSQL (9.6.1) and try logging into a database, I get the error:

cannot connect from psql due to invalid parameter "client_encoding"

Instructions here https://forums.aws.amazon.com/thread.jspa?messageID=529120 suggest

set PGCLIENTENCODING=UTF8

But when I open SQL Shell (psql) in Windows, I am never given the chance to enter this command:

enter image description here

How can I bridge this gap/fix this error? Thanks

Upvotes: 4

Views: 5381

Answers (2)

Gabe
Gabe

Reputation: 6097

this link provides some info too.

Just run this command in the command line: SET PGCLIENTENCODING=utf-8

enter image description here

https://dwgeek.com/psql-invalid-value-for-parameter-client_encoding-redshift.html/

Upvotes: 0

dave_thompson_085
dave_thompson_085

Reputation: 38990

set x=y is the Windows CMD syntax to set an environment variable, just as x=y;export x or export x=y or setenv x y is on most Unix shells.

You can pre-set a (semi)permanent env var in Windows from ControlPanel / System (or ThisPC rightclick Properties), AdvancedSystemSettings, Advanced tab, EnvironmentVariables button. Or from CMD with the SETX command; SETX /? for help or http://ss64.com/nt/setx.html . (Or directly in the registry, but if you have enough skill to use regedit safely you wouldn't ask this Q.)

Upvotes: 1

Related Questions