Re: overloading LIKE operator to handle integer + text

From: Shaun Thomas <sthomas(at)optionshouse(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: 'Thalis Kalfigkopoulos' <tkalfigo(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: overloading LIKE operator to handle integer + text
Date: 2012-10-30 20:25:43
Message-ID: 509037C7.3040702@optionshouse.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/30/2012 03:14 PM, David Johnston wrote:

> "LIKE" is apparently not an operator but a special SQL construct.

Almost. :) The real problem is this, from the manual:

"The operator name is a sequence of up to NAMEDATALEN-1 (63 by default)
characters from the following list:

+ - * / < > = ~ ! @ # % ^ & | ` ?

Grandparent might also want to mark his function as immutable so its
execution can be optimized. Aside from that, this works:

CREATE OPERATOR ~~ (LEFTARG=integer, RIGHTARG=text, PROCEDURE=my_like);

However, this only creates it in the current schema. If this really
should be usable for everyone, this should be the final statement:

CREATE OPERATOR PUBLIC.~~ (LEFTARG=integer, RIGHTARG=text,
PROCEDURE=my_like);

--
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-444-8534
sthomas(at)optionshouse(dot)com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email

In response to

Browse pgsql-general by date

  From Date Subject
Next Message elliott 2012-10-30 21:30:42 Autovacuum Launcher Process Exception
Previous Message David Johnston 2012-10-30 20:14:57 Re: overloading LIKE operator to handle integer + text