pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
"text to text" operator redefinition ignored
2+ messages / 2 participants
[nested] [flat]

* "text to text" operator redefinition ignored
@ 2012-12-21 19:10  ta@lavabit.com
  0 siblings, 1 reply; 2+ messages in thread

From: ta@lavabit.com @ 2012-12-21 19:10 UTC (permalink / raw)
  To: pgsql-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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: "text to text" operator redefinition ignored
@ 2012-12-24 21:39  Tom Lane <tgl@sss.pgh.pa.us>
  parent: ta@lavabit.com
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2012-12-24 21:39 UTC (permalink / raw)
  To: ta@lavabit.com; +Cc: pgsql-bugs

ta@lavabit.com writes:
> 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;

That search path setting doesn't do what you probably think.
See under "The System Catalog Schema" in
http://www.postgresql.org/docs/9.2/static/ddl-schemas.html

Other relevant documentation is in
http://www.postgresql.org/docs/9.2/static/typeconv-oper.html

			regards, tom lane


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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2012-12-24 21:39 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-12-21 19:10 "text to text" operator redefinition ignored ta@lavabit.com
2012-12-24 21:39 ` Tom Lane <tgl@sss.pgh.pa.us>

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