Em 07/04/11, Rogério Bassete<[email protected]> escreveu: > Pessoal, > > Alguém saberia me dizer por que o psqlODBC envia dados do tipo varchar como > bytea ao servidor PostgreSQL? > > LOG do banco de dados: > > INSERT INTO cor (cor,corfabrica) VALUES (E'teste',E'teste fábrica'); > > Quando o correto seria: > > INSERT INTO cor (cor,corfabrica) VALUES ('teste','teste fábrica'); > > Informações úteis: > > teste=# \d cor > id | integer | não nulo valor padrão de > nextval('cor_id_seq'::regclass) > cor | character varying(20) | não nulo > corfabrica | character varying(20) | não nulo > > psqlODBC 09.00.0200 Windows 32 > > PostgreSQL 9.0.3 Linux >
Isto não é bytea, é apenas a indicação de "escape" de eventuais caracteres precedidos por \ com significado especial. Veja: http://www.postgresql.org/docs/current/interactive/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS "4.1.2.2. String Constants with C-Style Escapes PostgreSQL also accepts "escape" string constants, which are an extension to the SQL standard. An escape string constant is specified by writing the letter E (upper or lower case) just before the opening single quote, e.g., E'foo'. (When continuing an escape string constant across lines, write E only before the first opening quote.) Within an escape string, a backslash character (\) begins a C-like backslash escape sequence, in which the combination of backslash and following character(s) represent a special byte value, as shown in Table 4-1. " http://www.postgresql.org/docs/current/interactive/runtime-config-compatible.html#RUNTIME-CONFIG-COMPATIBLE-VERSION "escape_string_warning (boolean) When on, a warning is issued if a backslash (\) appears in an ordinary string literal ('...' syntax) and standard_conforming_strings is off. The default is on. Applications that wish to use backslash as escape should be modified to use escape string syntax (E'...'), because the default behavior of ordinary strings will change in a future release for SQL compatibility. This variable can be enabled to help detect applications that will break." Osvaldo _______________________________________________ pgbr-geral mailing list [email protected] https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
