like query backslash

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: like query backslash
Date: 2007-01-14 09:15:52
Message-ID: eocsdv$2vc0$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

select version()
"PostgreSQL 8.0.1 on i686-pc-linux-gnu, compiled by GCC i686-pc-linux-gnu-gcc (GCC) 3.3.5 (Gentoo
Linux 3.3.5-r1, ssp-3.3.2-3, pie-8.7.7.1)"

I have a table with UNC filename values (windows), such as \\server\dir\fname.txt
I am running a like query to find all files on a specific server\dir.

I would expect to put 2 backslashes into my query for each one in the text in order to escape it,
however it is making me put in 4 backslashes for each backslash in the text.

To retrieve the above example, I needed to query:
select * from filetable where filename like '\\\\\\\\server\\\\dir%'

Is this a bug or is there a reason for this?

Sim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shoaib Mir 2007-01-14 11:41:37 Re: like query backslash
Previous Message Tom Lane 2007-01-14 04:22:49 Re: Corrupt database? 8.1/FreeBSD6.0