473,765 Members | 2,203 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Migrating between versions. Problem with regexp

Dear friends,

I have the following problem.

libvar=# select version();
version
----------------------------------------------------------------
PostgreSQL 7.2.3 on i386-pc-bsdi4.0.1, compiled by GCC 2.7.2.1
(1 row)

libvar=# select '\\a\\ŕ\\ŕ\\.' ~ '\\a\\ŕ\\ŕ\\.';
?column?
----------
f
(1 row)
=============== =============== =========

libvar=# select version();

version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 8.0.0beta1 on i686-pc-linux-gnu, compiled by GCC gcc (GCC)
3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
(1 row)

libvar=# select '\\a\\ŕ\\ŕ\\.' ~ '\\a\\ŕ\\ŕ\\.';
ERROR: invalid regular expression: invalid escape \ sequence

I am using:
This is perl, v5.6.0 built for i386-bsdos
When I receive a text from CGI I made quotemeta over it to avoid symbols
that may be met in regular expressions.
Then I made DBI->quote over the same string to avoid any sql injection;
The problem is that I use cyrillic and quotemeta put before every
cyrillic character a \.
Then DBI->quote make \ to \\.
And then when I use this string in regular expression in Postgres I
recevie an error in the new version of postgres.
Could anyone sugest solution to my problem.
10x in advance.
Kaloyan

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #1
4 1746
Kaloyan Iliev Iliev <ne***@faith.di gsys.bg> writes:
libvar=# select '\\a\\ŕ\\ŕ\\.' ~ '\\a\\ŕ\\ŕ\\.';
ERROR: invalid regular expression: invalid escape \ sequence


7.4 and later are stricter about the use of \ than prior versions; see
http://www.postgresql.org/docs/7.4/s...CAPE-SEQUENCES
You could go back to (approximately) the old behavior by changing
regex_flavor to "extended".

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2
Thank you
Kaloyan

Tom Lane wrote:
Kaloyan Iliev Iliev <ne***@faith.di gsys.bg> writes:

libvar=# select '\\a\\ŕ\\ŕ\\.' ~ '\\a\\ŕ\\ŕ\\.';
ERROR: invalid regular expression: invalid escape \ sequence


7.4 and later are stricter about the use of \ than prior versions; see
http://www.postgresql.org/docs/7.4/s...CAPE-SEQUENCES
You could go back to (approximately) the old behavior by changing
regex_flavor to "extended".

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
Dear Tom Lane,
I still haven't read all the documentation but I find the following.
If I escape with \\ latin letters it OK, but if escape with \\
cyrillic letters then it is a mistake.

libvar=# select '\\a\˙' ~* '\\a\˙';
?column?
----------
f
(1 row)

libvar=# select '\\a\\˙' ~* '\\a\\˙';
ERROR: invalid regular expression: invalid escape \ sequence
libvar=# select '\\a\\˙' ~* '\\a\˙';
?column?
----------
f
(1 row)

libvar=# select '\\a\˙' ~* '\\a\\˙';
ERROR: invalid regular expression: invalid escape \ sequence

So I understand that you can't adapt it to all languages and alphabets
but in case this is an error and can be fixed I report it.
Kaloyan

Tom Lane wrote:
Kaloyan Iliev Iliev <ne***@faith.di gsys.bg> writes:

libvar=# select '\\a\\ŕ\\ŕ\\.' ~ '\\a\\ŕ\\ŕ\\.';
ERROR: invalid regular expression: invalid escape \ sequence


7.4 and later are stricter about the use of \ than prior versions; see
http://www.postgresql.org/docs/7.4/s...CAPE-SEQUENCES
You could go back to (approximately) the old behavior by changing
regex_flavor to "extended".

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #4
Kaloyan Iliev Iliev <ne***@faith.di gsys.bg> writes:
I still haven't read all the documentation but I find the following.
If I escape with \\ latin letters it OK, but if escape with \\
cyrillic letters then it is a mistake.


No, you're missing the point: there are certain escapes that mean
something, and it rejects the rest. Backslash is not a general-purpose
quoting character.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2080
by: Tom Loredo | last post by:
Hi folks- I'm about to move from a Solaris 8/SPARC environment to a Dell running RedHat 9. Are there any issues I need to be aware of in bringing my Python code over (mostly scientific computation)? In particular, I know earlier versions of RH shipped with an "old" Python installed as "python" and that installation of more recent versions should not overwrite "python" (e.g., install as "python2.3"). Is this still the case in RH9? Any...
10
3277
by: Markus Enders | last post by:
Hi everybody, currently we use DB2 7.1 on several Solaris machines. Now we are planning, to migrate to SUSE Linux (newest version). I wonder, if we can keep our DB2 version 7.1, or if we need to upgrade to version 8. How are your experiences running DB2 in version 7.1 on Linux. How difficult is the migration from Solaris to Linux concerning DB2? Are there some pitfalls or can I simply install the DB2, create my database (tables and...
2
2459
by: Cam Chapman | last post by:
Does anyone have any experience migrating a DB2 database off UDB 6.1 (Solaris) to 7.2 (Linux)? The database does not already exist on the Linux box. Have created a DB2 instance fine. DB2 installation went ok (no fixpacks installed yet though!) and can create sample database and query. In my naiivity as a non dba reformed developer, I've dumped the database on the solaris box and am trying to perform a restore on the Linux box using the...
4
7478
by: Jon Maz | last post by:
Hi All, I want to strip the accents off characters in a string so that, for example, the (Spanish) word "práctico" comes out as "practico" - but ignoring case, so that "PRÁCTICO" comes out as "PRACTICO". What's the best way to do this? TIA,
4
2627
by: Collin Peters | last post by:
I have searched the Internet... but haven't found much relating to this. I am wondering on what the best practices are for migrating a developmemnt database to a release database. Here is the simplest example of my situation (real world would be more complex). Say you have two versions of your application. A release version and a development version. After a month of developing you are ready to release a new version. There have...
6
991
by: guy | last post by:
When migrating VB2003 source code to VB2005 are there any breaking changes? I can only find info that refers to different versions of the framework, and which is not what im looking for. cheers guy
4
2320
by: =?Utf-8?B?QXJqdW4=?= | last post by:
Hi, After migrating my application from VC++ 6.0 to VC++ 2005, I receive the error C2593 'operator +=' is ambiguous. It refers to the following line: Name += pManager->GetAgentName(); where Name is a string and GetAgentName also returns a string.
4
3908
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global' is not an appropriate modifier for the test() function - test() searches the entire string by default. However, I would expect it to degrade gracefully. Instead, I seem to be getting something as follows - using W3Schools handy page at :
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.