pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ta@lavabit.com
To: pgsql-bugs@postgresql.org
Subject: "text to text" operator redefinition ignored
Date: Fri, 21 Dec 2012 14:10:42 -0500 (EST)
Message-ID: <17605.87.252.128.91.1356117042.squirrel@lavabit.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

PG 9.2.2, Windows, empty database

just curious, redefinition of various operators seems to work nicely but
"text to text" operator redefinition (last block down here) seems
completely ignored:

set search_path to public;

select 'aa'::varchar = 'aa  '::varchar;  -- returns false
create or replace function public.opr_vceqvc(varchar, varchar)
  returns boolean as
  $$
    select rtrim($1)=rtrim($2)
  $$
  language sql immutable;
create operator public.= (leftarg = varchar, rightarg = varchar, procedure
= public.opr_vceqvc,  commutator = =, negator = <>, restrict = eqsel, join
= eqjoinsel, hashes, merges);
select 'aa'::varchar = 'aa  '::varchar;  -- returns true
drop operator if exists public.= (varchar, varchar);


select 'aa'::text = 'aa  '::varchar;  -- returns false
create or replace function public.opr_txeqvc(text, varchar)
  returns boolean as
  $$
    select rtrim($1)=rtrim($2)
  $$
  language sql immutable;
create operator public.= (leftarg = text, rightarg = varchar, procedure =
public.opr_txeqvc,  commutator = =, negator = <>, restrict = eqsel, join =
eqjoinsel, hashes, merges);
select 'aa'::text = 'aa  '::varchar;  -- returns true
drop operator if exists public.= (text, varchar);


select 'aa'::text = 'aa  '::text;  -- returns false
create or replace function public.opr_txeqtx(text, text)
  returns boolean as
  $$
    -- select rtrim($1)=rtrim($2);
    select true;
  $$
  language sql immutable;
create operator public.= (leftarg = text, rightarg = text, procedure =
public.opr_txeqtx,  commutator = =, negator = <>, restrict = eqsel, join =
eqjoinsel, hashes, merges);
select 'aa'::text = 'aa  '::text;  -- ALWAYS RETURNS FALSE!
drop operator if exists public.= (text, text);





-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)  latest in thread

Message-ID: <17605.87.252.128.91.1356117042.squirrel@lavabit.com>
Permalink:  ../17605.87.252.128.91.1356117042.squirrel@lavabit.com/
Also on:    postgresql.org/message-id/17605.87.252.128.91.1356117042.squirrel@lavabit.com

 · 

reply

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-bugs@postgresql.org
  Cc: ta@lavabit.com
  Subject: Re: "text to text" operator redefinition ignored
  In-Reply-To: <17605.87.252.128.91.1356117042.squirrel@lavabit.com>
  References: <17605.87.252.128.91.1356117042.squirrel@lavabit.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