Re: regular expression limit

Поиск
Список
Период
Сортировка
От Ron Peterson
Тема Re: regular expression limit
Дата
Msg-id 20070102132603.GC15601@yellowbank.com
обсуждение исходный текст
Ответ на Re: regular expression limit  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: regular expression limit  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Mon, Jan 01, 2007 at 11:30:00PM -0500, Tom Lane wrote:
> Ron Peterson <ron.peterson@yellowbank.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/

В списке pgsql-general по дате отправления:

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: [ADMIN] OUTER JOIN IS SLOW
Следующее
От: Tom Lane
Дата:
Сообщение: Re: regular expression limit