Re: [HACKERS] create operator problem

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: neko(at)kornel(dot)szif(dot)hu (Vazsonyi Peter[ke])
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] create operator problem
Date: 1998-04-25 22:07:31
Message-ID: 199804252207.SAA14984@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> Hello!
>
> I use an external function in postgres and here i try create operator for
> like with regional character support ::
>
> -----< Cut begin
> create function mylike(text,text) returns bool
> as '/home/vip/neko/tudakozo/comp.so' language 'c';
> CREATE
> select mylike('Jeno','Jen'),mylike('aJenO','Jen'),mylike('fJeNof','Jen'),
> mylike('JEnke','Jen');
> mylike|mylike|mylike|mylike
> ------+------+------+------
> t |t |t |t
> (1 row)
>
> select 'f:', mylike('asd','fds');
> ?column?|mylike
> --------+------
> f: |f
> (1 row)
>
> -- It works
>
> drop operator ~~ (text,text);
> DROP
> create operator ~~ (leftarg=text,rightarg=text,procedure=mylike);
> CREATE
> select 'this will be true'::text ~~ 'true';
> ?column?
> --------
> f
> (1 row)
> -- it seems not ;(
> -----< Cut end
>
> I'm not a realy postgres guru, but whith postgres 6.2 can i use this
> function as operator too. If that was a bug, this letter is a bug report,
> but if it isn't please help me! The used postgres's vn: 6.3-2, it runs on a
> linux (RH4.2;i386 + updates)

We overload ~~ to allow indexing of LIKE operations. Sorry. I will add
something to error on redefine of ~~.

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-04-26 02:30:25 Re: [HACKERS] Re: [INTERFACES] retrieving varchar size
Previous Message Ryan Kirkpatrick 1998-04-25 20:45:46 Patch to remove -Dalpha for Alphas...