Re: Prevent characters not transposable to LATIN9

From: Arnaud Lesauvage <arnaud(dot)listes(at)codata(dot)eu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Prevent characters not transposable to LATIN9
Date: 2010-07-01 14:53:51
Message-ID: 4C2CABFF.807@codata.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 1/07/2010 16:48, Sam Mason a écrit :
> 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?

What happens then for a character that does not have an equivalent in
LATIN9 ?
If an error is raised in the check constraint, does it look like a
normal check error ?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Leif Jensen 2010-07-01 15:05:07 Process- or SessionID with ECPG
Previous Message Sam Mason 2010-07-01 14:48:27 Re: Prevent characters not transposable to LATIN9