Search Postgresql Archives

Re: regular expression limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 01, 2007 at 11:30:00PM -0500, Tom Lane wrote:
> Ron Peterson <ron.peterson@xxxxxxxxxxxxxx> 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/


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux