Re: FInding "corrupt" values in UTF-8 tables (regexp question, I think)

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To:
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: FInding "corrupt" values in UTF-8 tables (regexp question, I think)
Date: 2007-08-17 17:58:49
Message-ID: D4733B08-DFCB-4F5C-A12B-AC0B6EF30727@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

[Please reply to the list so that others may benefit from and
participate in the discussion.]

On Aug 17, 2007, at 12:50 , Phoenix Kiula wrote:

> On 18/08/07, Michael Glaesemann <grzm(at)seespotcode(dot)net> wrote:
>
>>
>> On Aug 17, 2007, at 10:58 , Phoenix Kiula wrote:
>>
>>
>>> What would be the SQL to find data of this nature? My column can
>>> only
>>> have alphanumeric data, and the only symbols allowed are "-" and
>>> "_",
>>> so I tried this regexp query:
>>>
>>> select id, t_code
>>> from traders
>>> where t_code ~ '[^A-Za-z1-9\-]'
>>>
>>
>> If you're including - in a range as a character, doesn't it have to
>> go first?
>> Try this:
>>
>> WHERE t_code ~ $re$[^-A-Za-z1-9_]$re$
>>
>>
>
>
>
> Thanks, yes, this is sweet!
>
> If I include this into a check constraint on the table, would that be
> very resource intensive for INSERTs and UPDATEs?
>

Maybe. I don't know. What's very? Measure, change, and measure again.
Premature optimization and all that. :) First I make it correct.

Michael Glaesemann
grzm seespotcode net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message RAJARAM JAYARAMAN 2007-08-17 18:21:09 Re: I get a error msg when i try to connect to the DB
Previous Message Alvaro Herrera 2007-08-17 17:56:02 Re: [GENERAL] PostgreSQL, PGDAY, PGParty and OSCON 2007 Rocked!