From: Kyle <kyle@actarg.com>
To: pgsql-hackers@postgresql.org
To: pgsql-sql@postgresql.org
Subject: New operators
Date: Fri, 15 Sep 2000 09:55:57 -0600
Message-ID: <39C2468D.5A2DDBEF@actarg.com> (raw)
I have a front end that builds queries based on a user selection of:
Match type (=, <, >, ~, ~~, etc)
Ignore/honor upper/lower case
Negate the comparison
I ended up putting the following operators in the backend so the
operators all
had parallel types of case/no-case options. This made the front end
code much simpler.
Would it be helpful to others to make these built-in operators?
-- Case insensitive operators (for consistency with like operators)
create function likenocase(text,text) returns boolean as '
begin return upper($1) like upper($2); end;' language 'plpgsql' with
(iscachable);
create operator ~~* (leftarg = text,rightarg = text,procedure =
likenocase, negator = !~~*);
create function nlikenocase(text,text) returns boolean as '
begin return upper($1) not like upper($2); end;' language 'plpgsql'
with (iscachable);
create operator !~~* (leftarg = text,rightarg = text,procedure =
nlikenocase, negator = ~~*);
create function eqnocase(text,text) returns boolean as '
begin return upper($1) = upper($2); end;' language 'plpgsql' with
(iscachable);
create operator =* (leftarg = text,rightarg = text,procedure =
eqnocase, negator = !=*);
create function neqnocase(text,text) returns boolean as '
begin return upper($1) != upper($2); end;' language 'plpgsql' with
(iscachable);
create operator !=* (leftarg = text,rightarg = text,procedure =
neqnocase, negator = =*);
Attachments:kyle.vcf (text/x-vcard, 184B) download
begin:vcard
n:Bateman;Kyle
x-mozilla-html:FALSE
org:Action Target Inc.
adr:;;;;;;
version:2.1
email;internet:kyle@actarg.com
title:President
x-mozilla-cpt:;0
fn:Kyle Bateman
end:vcard
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: kyle@actarg.com, pgsql-hackers@postgresql.org
Subject: Re: New operators
In-Reply-To: <39C2468D.5A2DDBEF@actarg.com>
References: <39C2468D.5A2DDBEF@actarg.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