Question on inserting non-ascii strings

From: Steven Lembark <lembark(at)wrkhors(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Question on inserting non-ascii strings
Date: 2009-05-14 15:25:33
Message-ID: 20090514112533.16baf3e8@bird.wrkhors.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Using Postgres 8.3 with DBI 1.607, DBD::Pg 2.12.0, perl v5.10.0,

I am trying to insert the medline database
contents, which include non-ascii char's,
hopefully using a prepared query.

Playing with the locale, encoding,
client_encoding, standard_conforming_strings,
leaves me able to insert values using one-off
querys, but I need to find out the correct way
to handle these using prepared querys (currently
using C, SQL_ASCII, SQL_ASCII, off).

For example, given:

create table foo ( bar varchar(255) );

and the author's name

"P\x8FAZEK"

Setting the client_encoding to "SQL_ASCII"
does not help: the values can be inserted
via

E'P\x8FAZEK'

but E'$1' will simply insert the "$1" literal
into the table.

Using

convert_from( $1, 'SQL_ASCII' ) gets

gets the values input, but with a warning.

Q: Is there any combination of locale, encoding,
client_encoding or functions that will allow
me to insert values with these escape sequences
without getting the warnings?

Trying this in psql with various combinations of
prepares statements leaves me unable to use
convert_from with a varchar argument (requires
bytea).

If there is an example in the doc's I'd appreciate
a link to it.

thanks

--
Steven Lembark 85-09 90th St.
Workhorse Computing Woodhaven, NY, 11421
lembark(at)wrkhors(dot)com +1 888 359 3508

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-05-14 15:30:35 Re: Failure during initdb - creating dictionaries ... FATAL: could not access file "$libdir/libdict_snowball": No such file or directory
Previous Message John R Pierce 2009-05-14 15:16:22 Re: postgresql on windows98