Received: from actarg.com (host25.actarg.com [209.180.91.25] (may be forged)) by hub.org (8.10.1/8.10.1) with ESMTP id e8FFu3s23210; Fri, 15 Sep 2000 11:56:04 -0400 (EDT) Received: from chi.actarg.com (IDENT:root@chi.actarg.com [192.168.2.16]) by actarg.com (8.9.3/8.9.3) with ESMTP id JAA22530; Fri, 15 Sep 2000 09:55:58 -0600 Received: from actarg.com (IDENT:kyle@localhost [127.0.0.1]) by chi.actarg.com (8.9.3/8.9.3) with ESMTP id JAA12583; Fri, 15 Sep 2000 09:55:57 -0600 Message-ID: <39C2468D.5A2DDBEF@actarg.com> Date: Fri, 15 Sep 2000 09:55:57 -0600 From: Kyle Organization: Action Target Inc. X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-hackers@postgresql.org, pgsql-sql@postgresql.org Subject: New operators Content-Type: multipart/mixed; boundary="------------F8FE4FE0224356707E325B2A" X-Archive-Number: 200009/116 This is a multi-part message in MIME format. --------------F8FE4FE0224356707E325B2A Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 = =*); --------------F8FE4FE0224356707E325B2A Content-Type: text/x-vcard; charset=us-ascii; name="kyle.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Kyle Content-Disposition: attachment; filename="kyle.vcf" 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 --------------F8FE4FE0224356707E325B2A--