LIKE wildcards escaping problem

From: Thea <monika(dot)morawiecka(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: LIKE wildcards escaping problem
Date: 2007-09-24 12:09:54
Message-ID: 1190635794.984573.199480@w3g2000hsg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello folks :)

I am working on a system that is possible to configure to work with
several DBMSes, including PG.

My problem is that PG behaves differently than other supported DBMSes
(MSSQL and MySQL) - when I'm passing a query containing LIKE phrase to
it, a double amount of '/' literals is needed to obtain expected
result. I do realize that this is caused by a parser 'collapsing'
double '/' to a single one.
I might not express this clearly, but - as I understand it - in
general result is that to find '/' literal in DB, '////' phrase is
needed ('////' is turned to '//' by a parser, and that is valid
expression for '/' literal in SQL itself).

The problem is that I cannot really use ESCAPE clause - it would
require working on too many files. (there are about 6k files in this
project, changing most of them would be not only not feasible, but
also risky)
The problem is that there is a table with user names. Those can
contain '/' literal (if they are domain users for example.) And here I
hit the wall. Any search for username with '/' literal fails.
I've searched through postgres mailing lists and all feed I could
google out, and found some info about problem itself, but I was unable
to find a solution for it anywhere.

Problem was addressed in following locations:
http://svr5.postgresql.org/pgsql-general/1999-07/msg00340.php
http://svr5.postgresql.org/pgsql-sql/1999-03/msg00144.php

But those posts are from 1999, and I did not find anything more up-to-
date.
Has anyone solved this problem?
Is there any configuration option in PG allowing to make it behave in
a more compliant way?

I'd be more than happy to see something like Herouth Maoz suggested
in
http://svr5.postgresql.org/pgsql-general/1999-07/msg00340.php , namely
configuration option for PG, but I was unable to find it.

Sorry if I messed something up... I'm really very confused with this
sftuff...
I will appreciate any help or explanation, if I missed something
important.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-09-24 12:16:24 Re: CREATE DATABASE cannot be executed from a function or multi-command string
Previous Message Andrew Dunstan 2007-09-24 11:49:59 Re: Bytea as C string in pg_convert?