regexp incompatibilites 7.3 and 7.4

Started by Oleg Bartunovover 22 years ago3 messageshackers
Jump to latest
#1Oleg Bartunov
oleg@sai.msu.su

Hi,

seems for regexp which works in 7.3 is failing in 7.4.
Is't possible to configure pgsql to be compatible with 7.3 regexp ?

Welcome to psql 7.3.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

discovery=# select 'problem' ~ '^\\p';
?column?
----------
t
(1 row)

Welcome to psql 7.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit

www=# select 'problem' ~ '^\\p';
ERROR: invalid regular expression: invalid escape \ sequence

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Oleg Bartunov (#1)
Re: regexp incompatibilites 7.3 and 7.4

Oleg Bartunov <oleg@sai.msu.su> writes:

seems for regexp which works in 7.3 is failing in 7.4.
Is't possible to configure pgsql to be compatible with 7.3 regexp ?

SET regex_flavor TO extended;

www=# select 'problem' ~ '^\\p';
ERROR: invalid regular expression: invalid escape \ sequence

I think, though, that this is telling you about a bug in your
application. You do realize that under extended regex rules there's
no difference between that pattern and '^p' ? Is that *really* what
you want?

regards, tom lane

#3Oleg Bartunov
oleg@sai.msu.su
In reply to: Tom Lane (#2)
Re: regexp incompatibilites 7.3 and 7.4

On Mon, 24 Nov 2003, Tom Lane wrote:

Oleg Bartunov <oleg@sai.msu.su> writes:

seems for regexp which works in 7.3 is failing in 7.4.
Is't possible to configure pgsql to be compatible with 7.3 regexp ?

SET regex_flavor TO extended;

aha, thanks a lot

www=# select 'problem' ~ '^\\p';
ERROR: invalid regular expression: invalid escape \ sequence

I think, though, that this is telling you about a bug in your
application. You do realize that under extended regex rules there's
no difference between that pattern and '^p' ? Is that *really* what
you want?

Actually, we have old application which uses perl function quotemeta()
which escaped any cyrillic characters. I used in example latin characters
for simplicity. I have to use double backslash in psql only.

regards, tom lane

Regards,
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83