Thread: client_encoding error on load
I'm using these commands to perform a dump and load.
pg_dump -c lakevie_typo | gzip > $HOME/backups/typo_$DATE.sql.gz
gzip < $HOME/backups/typo_$DATE.sql.gz |psql -d lakevie_typobak -f -
The dump is fine but the load only works if I first extract the sql, then run it. Running it using the pipe to psql, I get:
psql:<stdin>:71: ERROR: invalid byte sequence for encoding "UTF8": 0x8b
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
yet, doing a 'psql -l' shows this database to be UTF-8. And the dump file says:
SET client_encoding = 'UTF8';
My goal is to get the two line dump/load working so I don't have any manual steps and sql files laying around. Any ideas?
Andy
pg_dump -c lakevie_typo | gzip > $HOME/backups/typo_$DATE.sql.gz
gzip < $HOME/backups/typo_$DATE.sql.gz |psql -d lakevie_typobak -f -
The dump is fine but the load only works if I first extract the sql, then run it. Running it using the pipe to psql, I get:
psql:<stdin>:71: ERROR: invalid byte sequence for encoding "UTF8": 0x8b
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
yet, doing a 'psql -l' shows this database to be UTF-8. And the dump file says:
SET client_encoding = 'UTF8';
My goal is to get the two line dump/load working so I don't have any manual steps and sql files laying around. Any ideas?
Andy
"Andrew Goodnough" <agoodno@gmail.com> writes: > I'm using these commands to perform a dump and load. > pg_dump -c lakevie_typo | gzip > $HOME/backups/typo_$DATE.sql.gz > gzip < $HOME/backups/typo_$DATE.sql.gz |psql -d lakevie_typobak -f - Surely the second step must start with gunzip? regards, tom lane
It will better you export and import through network by using following command.
psql -U < schemaname > < databasename> --schema=schemaname | psql -U postgres -h < IP adddress of system where you are importing data> <database name>
----- Original Message -----From: Andrew GoodnoughSent: Monday, August 04, 2008 7:29 AMSubject: [ADMIN] client_encoding error on loadI'm using these commands to perform a dump and load.
pg_dump -c lakevie_typo | gzip > $HOME/backups/typo_$DATE.sql.gz
gzip < $HOME/backups/typo_$DATE.sql.gz |psql -d lakevie_typobak -f -
The dump is fine but the load only works if I first extract the sql, then run it. Running it using the pipe to psql, I get:
psql:<stdin>:71: ERROR: invalid byte sequence for encoding "UTF8": 0x8b
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".
yet, doing a 'psql -l' shows this database to be UTF-8. And the dump file says:
SET client_encoding = 'UTF8';
My goal is to get the two line dump/load working so I don't have any manual steps and sql files laying around. Any ideas?
Andy
On Sun, Aug 3, 2008 at 9:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Yeah, that's gotta be it. Dumb error, thanks."Andrew Goodnough" <agoodno@gmail.com> writes:Surely the second step must start with gunzip?
> I'm using these commands to perform a dump and load.
> pg_dump -c lakevie_typo | gzip > $HOME/backups/typo_$DATE.sql.gz
> gzip < $HOME/backups/typo_$DATE.sql.gz |psql -d lakevie_typobak -f -
regards, tom lane
Andy