From: ciifrancesco@tiscali.it <ciifrancesco@tiscali.it>
To: pgsql-it-generale@postgresql.org
Subject: Novità -- problema Cinese in DB UTF8
Date: Wed, 14 Aug 2013 09:45:28 +0200 (CEST)
Message-ID: <8015825.7251376466328701.JavaMail.defaultUser@defaultHost> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-it-generale>
Allora,
ho fatto i seguenti passi:
1. ho modificato i template in modo che anche essi siano:
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------+-------+----------+-------------+-------------+-------------------
postgres | pedro | UTF8 | it_IT.UTF-8 | it_IT.UTF-8 |
mioDB | pedro | UTF8 | it_IT.UTF-8 | it_IT.UTF-8 |
template0 | pedro | UTF8 | it_IT.UTF-8 | it_IT.UTF-8 |
template1 | pedro | UTF8 | it_IT.UTF-8 | it_IT.UTF-8 |
Non mi piacciono i nomi di nazioni o lingue per del testo universale, ma da quanto ho capito, qualsiasi collate o Ctype/Collate che finisce per UTF-8 va bene (+ dettagli nella guida in PS che metto perché può essere utile a qualcuno).
2. ho fatto un dump. Siccome non avevo memoria sufficiente, ho dovuto farlo compresso:
pg_dump dbname | gzip > filename.gz3. ho quindi eliminato mioDB e l'ho ricreato come si vede sopra, con collate e Ctype corretti
4. quindi cerco di rimettere i dati nel DB:
gunzip -c filename.gz | psql dbnamema il DB risulta vuoto a dispetto della lunghezza dell'operazione e l'assenza di errori. Usare il metodo
cat filename.gz | gunzip | psql dbnamenon cambia niente. Entrambi sono su http://www.postgresql.org/docs/9.1/static/backup-dump.html
mioDB=# \dv
No relations found.
Se avete qualche idea...
Francesco
PS
per convertire i template dò questa procedura, che in italiano non facilmente si trova. Devo fare una forte critica a google, che nonostante avessi fatto delle ricerche usando parole chiave simili, non mi ha portato alle pagine con questa procedura. Credo sia a causa delle ricerche personalizzate che fanno arrivare utenti diversi a risultati diversi, ma così facendo oscurano una parte del web o la rendono più irraggiungibile, come per me la pagina https://gist.github.com/ffmike/877447 -- dalla quale mi sono ispirato e che ho completato per modificare anche i collate e ctype dei template:
postgres # update pg_database set datallowconn = TRUE where datname = 'template0';
postgres # \c template0
template0 # update pg_database set datistemplate = FALSE where datname = 'template1';
template0 # drop database template1;
template0 # create database template1 with template = template0 encoding = 'UTF8' LC_COLLATE = 'it_IT.UTF-8' LC_CTYPE = 'it_IT.UTF-8';
template0 # update pg_database set datistemplate = TRUE where datname = 'template1';
template0 # \c template1
template1 # drop database template0;
template1 # create database template0 with template = template1 encoding = 'UTF8' LC_COLLATE = 'it_IT.UTF-8' LC_CTYPE = 'it_IT.UTF-8';
template1 # drop database postgres;
template1 # create database postgres with template = template1 encoding = 'UTF8' LC_COLLATE = 'it_IT.UTF-8' LC_CTYPE = 'it_IT.UTF-8';
template1 # update pg_database set datallowconn = FALSE where datname = 'template0';
(idem se usate altri template per sapere i formati supportati dalla vostra macchina, ad esempio it_IT.UTF-8 digitate il comando locale, ovviamente su linux)
Invita i tuoi amici e Tiscali ti premia! Il consiglio di un amico vale più di uno spot in TV. Per ogni nuovo abbonato 30 € di premio per te e per lui! Un amico al mese e parli e navighi sempre gratis: http://freelosophy.tiscali.it/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-it-generale@postgresql.org
Cc: ciifrancesco@tiscali.it
Subject: Re: Novità -- problema Cinese in DB UTF8
In-Reply-To: <8015825.7251376466328701.JavaMail.defaultUser@defaultHost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox