2009/12/28 Luiz Augusto Machado da Silva <[email protected]>:
> Boa Tarde pessoal,
>
> Aproveitando o assunto abordado, eu estou com alguns problemas com a versão
> 8.4.2 !
> Quando eu utilizava a versão 8.2 e precisava criar um banco usando uma
> codificação diferente, era simples ...
> createdb teste --encoding sql_ascii
> Só que com a versão 8.4, ao tentar criar um banco com uma codificação
> diferente do template padrão ele me apresenta um erro:
>
> createdb: criação do banco de dados falhou: ERRO:  new encoding (SQL_ASCII)
> is incompatible with the encoding of the template database (UTF8)
> DICA:  Use the same encoding as in the template database, or use template0
> as template.
>
> Pesquisei na Internet uma solução para isso e infelizmente não consegui
> nenhuma solução !
>


Em primeiro lugar: utilizar SQL_ASCII é a pior escolha possível,
significa não fazer nenhuma verificação de validade dos caracteres
[1]. Procure no histórico da lista que você encontrará explicações
detalhadas. Como diz o manual seu uso é "insensato" se você tratar
qualquer caracter não ASCII (fora da faixa 0-127):
"No encoding conversion will be done when the setting is SQL_ASCII.
Thus, this setting is not so much a declaration that a specific
encoding is in use, as a declaration of ignorance about the encoding.
In most cases, if you are working with any non-ASCII data, it is
unwise to use the SQL_ASCII setting, because PostgreSQL will be unable
to help you by converting or validating non-ASCII characters. "

Na versão 8.4 você pode especificar databases com diferentes encodings
utilizando como template o template0, veja exemplo em [2].

Osvaldo

[1] 
http://www.postgresql.org/docs/current/interactive/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED
[2] http://www.postgresql.org/docs/current/interactive/multibyte.html#AEN29713
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a