Re: Prevent characters not transposable to LATIN9 - Mailing list pgsql-general

From Sam Mason
Subject Re: Prevent characters not transposable to LATIN9
Date
Msg-id 20100701144826.GG7584@samason.me.uk
Whole thread Raw
In response to Prevent characters not transposable to LATIN9  (Arnaud Lesauvage <arnaud.listes@codata.eu>)
Responses Re: Prevent characters not transposable to LATIN9
List pgsql-general
On Tue, Jun 29, 2010 at 04:52:22PM +0200, Arnaud Lesauvage wrote:
> We have a database in UTF8, from which we have to export text files in
> LATIN9 encoding (or WIN1252, which is almostthe same I believe).
>
> Records are entered via MSAccess forms (on psqlodbc-linked tables).
> The problem is that some of the characters input by the users have no
> equivalent in LATIN9.
>
> How could I easily write a CONSTRAINT (or RULE) that would check that
> everything entered in the fields have an equivalent in my specific
> destination encoding ?

How about using the built in character conversion routines.  Something
like:

  col = convert_from(convert_to(col, 'LATIN9'),'LATIN9')

as the check constraint, or its inverse as the where clause for the
erroneous rows?

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Arnaud Lesauvage
Date:
Subject: Re: Prevent characters not transposable to LATIN9
Next
From: Arnaud Lesauvage
Date:
Subject: Re: Prevent characters not transposable to LATIN9