Re: invalid UTF-8 via pl/perl
| От | Hannu Krosing |
|---|---|
| Тема | Re: invalid UTF-8 via pl/perl |
| Дата | |
| Msg-id | 1268085981.2855.13.camel@hvost обсуждение исходный текст |
| Ответ на | Re: invalid UTF-8 via pl/perl (Andrew Dunstan <andrew@dunslane.net>) |
| Ответы |
Re: invalid UTF-8 via pl/perl
|
| Список | pgsql-hackers |
On Sat, 2010-01-02 at 20:51 -0500, Andrew Dunstan wrote:
>
> Andrew Dunstan wrote:
> >
> > I think the plperl glue code should check returned strings using
> > pg_verifymbstr().
> >
> >
>
> Please test this patch. I think we'd probably want to trap the encoding
> error and issue a customised error message, but this plugs all the holes
> I can see with the possible exception of values inserted via SPI calls.
> I'll check that out.
I got a report, that the patch fixes one case but leaves open another:
CREATE TABLE utf_test
( id serial PRIMARY KEY, data character varying
);
CREATE OR REPLACE FUNCTION utf_test() RETURNS character varying AS
$BODY$
return "\xd0";
$BODY$ LANGUAGE 'plperlu' VOLATILE STRICT;
CREATE OR REPLACE FUNCTION utf_test2() RETURNS character varying AS
$BODY$
spi_exec_query("insert into utf_test (data) values('\xd0');");
return "VIGA";
$BODY$ LANGUAGE 'plperlu' VOLATILE STRICT;
The report siad, that patch fixes case
insert into utf_test (data) values(utf_test());
so that it return an error, but the second function
select utf_test2();
still enters wrong data to the table
So SPI interface should also be fixed, either from perl side, or maybe
from inside SPI ?
--
Hannu Krosing http://www.2ndQuadrant.com
PostgreSQL Scalability and Availability Services, Consulting and Training
В списке pgsql-hackers по дате отправления: