"text to text" operator redefinition ignored
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
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