From: Zalman Stern <zalman@netcom.com>
To: maillist@candle.pha.pa.us
Cc: zalman@netcom.com
Cc: herouth@oumail.openu.ac.il
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] How match percent sign in SELECT using LIKE?
Date: Tue, 16 Mar 1999 14:55:33 -0800 (PST)
Message-ID: <199903162255.OAA28174@netcom15.netcom.com> (raw)
In-Reply-To: <199903162226.RAA20904@candle.pha.pa.us>
Bruce Momjian wrote:
> That is also an excellent idea. Just convert their escape to \ inside
> the parser. Of course, they still have to use \\ to get a \, as in any
> string. Great idea.
You can even make it fully compliant if you want. (There are of course
backward compatibility problems. I'm not sure what the Postgres policy is
on this.)
- If the escape character is backslash, do nothing.
- Otherwise, turn all backslashes in the string to double backslashes.
- If the escape character is not set, stop here.
- Turn all occurences of the escape character into a backslash except
where the escape character is doubled, where it should be made into a
single occurence.
(Optionally, if "\n" is just an 'n' character, you can handle double
occurences of the escape character by turning the first one into a
backslash.)
Probably the best bet for PostgreSQL programmers is to always code Like
clauses with an ESCAPE '\' (or however its written).
I really wish they'd chosen a character other than underscore for the
"match one" wildcard... Is there any standard practice for seperating words
in table names?
-Z-
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: zalman@netcom.com, maillist@candle.pha.pa.us, herouth@oumail.openu.ac.il
Subject: Re: [SQL] How match percent sign in SELECT using LIKE?
In-Reply-To: <199903162255.OAA28174@netcom15.netcom.com>
References: <199903162226.RAA20904@candle.pha.pa.us> <199903162255.OAA28174@netcom15.netcom.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox