Thread: Redefine operator = for text

Redefine operator = for text

From
yura
Date:
Hello All,

Is it possible to change the behavior of operator "=" for text? I
wolud like to redefine this operator in order to it compare strings
without checking of letter case.
I tried the following:

create function TextEqual(text, text)
  returns bool
  as '
  begin
    if texteq(upper($1), upper($2)) then
      return TRUE;
    else
      return FALSE;
    end if;
  end;
  '
  language 'plpgsql';

drop operator = (text, text);
create operator = (
        leftarg=text,
        rightarg=text,
        procedure=TextEqual,
        commutator='=',
        negator='<>',
        restrict=eqsel,
        join=eqjoinsel
        );


This works, but after that many queries return error "unknown operator
98".

--
Best regards,
Yury                          mailto:yura@vpcit.ru



[GENERAL] a problem with single char recoding

From
Marcin Inkielman
Date:
hi all!

i have 2 boxes in my local net:
192.168.1.1 - linux 2.2.12/postgres 6.5.3
192.168.1.2 - windows 98+postgres_odbc+MS Access 97

i want use my postgres database in 3 ways:
- via psql,
- with libpq,CGI,HTTP -> MS Explorer on my Win boxe
- with ODBC on MS Access

the problem is that my linux box runs with LATIN2 and Windows
with 1250 charset.

I know that Postgres offers a method of character recoding.
Following docs and hints from this list I configured my Postgres with
apropriate options and this recoding works quite well but....

when I start postmaster and access my database
1. with libpq, CGI: LATIN2 on my browser works fine - OK
2. with ODBC+ACCESS : WIN 1250 - OK

and then I retry it with

3. libpq, CGI, browser - WIN1250 is still there - WRONG
4. psql - has also WIN1250 !!!

when I restart postmaster psql/libpq work fine again

I tryed to connect libpq via lo and eth0 interface with the same result
and my charset.conf is:

------------------------------
BaseCharset    iso

RecodeTable    iso    win    iso-win.tab
RecodeTable    win    iso    win-iso.tab

HostCharset     192.168.1.1    iso
HostCharset    192.168.1.2    win
HostCharset    localhost     iso
------------------------------

i think files iso-win.tab/win-iso.tab are ok.

thanks for any hint...



************************************

    Marcin Inkielman

************************************