| From: | Hannu Krosing <hannu(at)2ndquadrant(dot)com> |
|---|---|
| To: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | invalid UTF-8 via pl/perl |
| Date: | 2010-01-02 22:21:51 |
| Message-ID: | 1262470911.1813.16.camel@huvostro |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
It is possible to get an invalid byte sequence into a text field via pl,
in this case pl/perl :
---8<------8<------8<------8<------8<------8<---
CREATE TABLE utf_test
(
id serial PRIMARY KEY,
data character varying
);
CREATE OR REPLACE FUNCTION invalid_utf_seq()
RETURNS character varying AS
$BODY$
return "\xd0";
$BODY$
LANGUAGE 'plperlu' VOLATILE STRICT;
insert into utf_test(data) values(invalid_utf_seq());
---8<------8<------8<------8<------8<------8<---
This results in a table, which has invalid utf sequence in it and
consequently does not pass dump/load
What would be the best place to fix this ?
Should there be checks in all text types ?
(probably too expensive)
Or should pl/perl check it's return values for compliance with
server_encoding ?
Or should postgresql itself check that pl-s return what they promise to
return ?
--
Hannu Krosing http://www.2ndQuadrant.com
PostgreSQL Scalability and Availability
Services, Consulting and Training
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2010-01-02 22:34:19 | Re: psql tab completion for DO blocks |
| Previous Message | David Fetter | 2010-01-02 22:21:39 | Re: psql tab completion for DO blocks |