Re: regular expression limit

From: Ron Peterson <ron(dot)peterson(at)yellowbank(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: regular expression limit
Date: 2007-01-02 13:26:03
Message-ID: 20070102132603.GC15601@yellowbank.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jan 01, 2007 at 11:30:00PM -0500, Tom Lane wrote:
> Ron Peterson <ron(dot)peterson(at)yellowbank(dot)com> writes:
> > I believe there's been a change in PostgreSQL's regular expression
> > handling w/ 8.2.
>
> Compared to what? A repeat count of 256 has been an error at least
> since 7.4, and is documented as such:
>
> : The numbers m and n within a bound are unsigned decimal integers with
> : permissible values from 0 to 255 inclusive.
>
> > I'd like the following domain statement to work. It used to work in
> > 8.1.4, but not now.
>
> Sorry, I don't believe 8.1 took it either.

Hmm, my test table fails in 8.1.4 also, but my actual use case works in
8.1.4 but not 8.2.

CREATE DOMAIN
__hex_string_8192
AS TEXT
CHECK ( VALUE ~ '^[a-f0-9]{1,8192}$' );

CREATE TYPE __rsa_keys AS (
n
__hex_string_8192,
e
__hex_string_8192,
d
__hex_string_8192
);

CREATE OR REPLACE FUNCTION
y_pkcs_generate_rsa_keys(rd TEXT, sl INTEGER, mb INTEGER)
RETURNS
__rsa_keys
AS
'y_pkcs.so', 'y_pkcs_generate_rsa_keys'
LANGUAGE
C
STRICT IMMUTABLE;

When I call y_pkcs_generate_rsa_keys in 8.1.4 it works. When I call
this function in 8.2 it fails with the regular expression limit error.

I'll just revise my constraint as you suggested.

> Consider separating your concerns, eg
>
> CHECK( length(VALUE) <= 8192 AND VALUE ~ '^[a-f0-9]+$' )

That works for me. Thanks.

--
Ron Peterson
https://www.yellowbank.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-01-02 14:50:10 Re: regular expression limit
Previous Message Alban Hertroys 2007-01-02 10:57:36 Re: [GENERAL] OUTER JOIN IS SLOW