diff options
| author | Tom Lane | 2018-12-19 22:46:07 +0000 |
|---|---|---|
| committer | Tom Lane | 2018-12-19 22:46:25 +0000 |
| commit | 2ece7c07dc9a14667c64f107686573590b7e45c3 (patch) | |
| tree | 8b25e2d875d21defd1cbe3dcc3be9c22134fd002 /src/test | |
| parent | 586b98fdf1aaef4a27744f8b988479aad4bd9a01 (diff) | |
Add text-vs-name cross-type operators, and unify name_ops with text_ops.
Now that name comparison has effectively the same behavior as text
comparison, we might as well merge the name_ops opfamily into text_ops,
allowing cross-type comparisons to be processed without forcing a
datatype coercion first. We need do little more than add cross-type
operators to make the opfamily complete, and fix one or two places
in the planner that assumed text_ops was a single-datatype opfamily.
I chose to unify hash name_ops into hash text_ops as well, since the
types have compatible hashing semantics. This allows marking the
new cross-type equality operators as oprcanhash.
(Note: this doesn't remove the name_ops opclasses, so there's no
breakage of index definitions. Those opclasses are just reparented
into the text_ops opfamily.)
Discussion: https://postgr.es/m/15938.1544377821@sss.pgh.pa.us
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/opr_sanity.out | 14 | ||||
| -rw-r--r-- | src/test/regress/expected/regex.out | 14 | ||||
| -rw-r--r-- | src/test/regress/expected/select_views.out | 40 |
3 files changed, 41 insertions, 27 deletions
diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 6dca1b7bf34..214ad2d619c 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -525,6 +525,20 @@ int24ge(smallint,integer) int42ge(integer,smallint) oideq(oid,oid) oidne(oid,oid) +nameeqtext(name,text) +namelttext(name,text) +nameletext(name,text) +namegetext(name,text) +namegttext(name,text) +namenetext(name,text) +btnametextcmp(name,text) +texteqname(text,name) +textltname(text,name) +textlename(text,name) +textgename(text,name) +textgtname(text,name) +textnename(text,name) +bttextnamecmp(text,name) float4eq(real,real) float4ne(real,real) float4lt(real,real) diff --git a/src/test/regress/expected/regex.out b/src/test/regress/expected/regex.out index 79a7fa7a845..c0bfa8a842c 100644 --- a/src/test/regress/expected/regex.out +++ b/src/test/regress/expected/regex.out @@ -299,7 +299,7 @@ explain (costs off) select * from pg_proc where proname ~ '^abc'; QUERY PLAN ---------------------------------------------------------------------- Index Scan using pg_proc_proname_args_nsp_index on pg_proc - Index Cond: ((proname >= 'abc'::name) AND (proname < 'abd'::name)) + Index Cond: ((proname >= 'abc'::text) AND (proname < 'abd'::text)) Filter: (proname ~ '^abc'::text) (3 rows) @@ -307,7 +307,7 @@ explain (costs off) select * from pg_proc where proname ~ '^abc$'; QUERY PLAN ------------------------------------------------------------ Index Scan using pg_proc_proname_args_nsp_index on pg_proc - Index Cond: (proname = 'abc'::name) + Index Cond: (proname = 'abc'::text) Filter: (proname ~ '^abc$'::text) (3 rows) @@ -315,7 +315,7 @@ explain (costs off) select * from pg_proc where proname ~ '^abcd*e'; QUERY PLAN ---------------------------------------------------------------------- Index Scan using pg_proc_proname_args_nsp_index on pg_proc - Index Cond: ((proname >= 'abc'::name) AND (proname < 'abd'::name)) + Index Cond: ((proname >= 'abc'::text) AND (proname < 'abd'::text)) Filter: (proname ~ '^abcd*e'::text) (3 rows) @@ -323,7 +323,7 @@ explain (costs off) select * from pg_proc where proname ~ '^abc+d'; QUERY PLAN ---------------------------------------------------------------------- Index Scan using pg_proc_proname_args_nsp_index on pg_proc - Index Cond: ((proname >= 'abc'::name) AND (proname < 'abd'::name)) + Index Cond: ((proname >= 'abc'::text) AND (proname < 'abd'::text)) Filter: (proname ~ '^abc+d'::text) (3 rows) @@ -331,7 +331,7 @@ explain (costs off) select * from pg_proc where proname ~ '^(abc)(def)'; QUERY PLAN ---------------------------------------------------------------------------- Index Scan using pg_proc_proname_args_nsp_index on pg_proc - Index Cond: ((proname >= 'abcdef'::name) AND (proname < 'abcdeg'::name)) + Index Cond: ((proname >= 'abcdef'::text) AND (proname < 'abcdeg'::text)) Filter: (proname ~ '^(abc)(def)'::text) (3 rows) @@ -339,7 +339,7 @@ explain (costs off) select * from pg_proc where proname ~ '^(abc)$'; QUERY PLAN ------------------------------------------------------------ Index Scan using pg_proc_proname_args_nsp_index on pg_proc - Index Cond: (proname = 'abc'::name) + Index Cond: (proname = 'abc'::text) Filter: (proname ~ '^(abc)$'::text) (3 rows) @@ -354,7 +354,7 @@ explain (costs off) select * from pg_proc where proname ~ '^abcd(x|(?=\w\w)q)'; QUERY PLAN ------------------------------------------------------------------------ Index Scan using pg_proc_proname_args_nsp_index on pg_proc - Index Cond: ((proname >= 'abcd'::name) AND (proname < 'abce'::name)) + Index Cond: ((proname >= 'abcd'::text) AND (proname < 'abce'::text)) Filter: (proname ~ '^abcd(x|(?=\w\w)q)'::text) (3 rows) diff --git a/src/test/regress/expected/select_views.out b/src/test/regress/expected/select_views.out index bf003adf243..1aeed8452bd 100644 --- a/src/test/regress/expected/select_views.out +++ b/src/test/regress/expected/select_views.out @@ -1326,10 +1326,10 @@ NOTICE: f_leak => hamburger (1 row) EXPLAIN (COSTS OFF) SELECT * FROM my_property_normal WHERE f_leak(passwd); - QUERY PLAN --------------------------------------------------------------- + QUERY PLAN +------------------------------------------------------ Seq Scan on customer - Filter: (f_leak(passwd) AND (name = (CURRENT_USER)::text)) + Filter: (f_leak(passwd) AND (name = CURRENT_USER)) (2 rows) SELECT * FROM my_property_secure WHERE f_leak(passwd); @@ -1340,12 +1340,12 @@ NOTICE: f_leak => passwd123 (1 row) EXPLAIN (COSTS OFF) SELECT * FROM my_property_secure WHERE f_leak(passwd); - QUERY PLAN ------------------------------------------------ + QUERY PLAN +--------------------------------------------- Subquery Scan on my_property_secure Filter: f_leak(my_property_secure.passwd) -> Seq Scan on customer - Filter: (name = (CURRENT_USER)::text) + Filter: (name = CURRENT_USER) (4 rows) -- @@ -1367,10 +1367,10 @@ NOTICE: f_leak => hamburger EXPLAIN (COSTS OFF) SELECT * FROM my_property_normal v WHERE f_leak('passwd') AND f_leak(passwd); - QUERY PLAN ------------------------------------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------------------------------------- Seq Scan on customer - Filter: (f_leak('passwd'::text) AND f_leak(passwd) AND (name = (CURRENT_USER)::text)) + Filter: (f_leak('passwd'::text) AND f_leak(passwd) AND (name = CURRENT_USER)) (2 rows) SELECT * FROM my_property_secure v @@ -1386,12 +1386,12 @@ NOTICE: f_leak => passwd EXPLAIN (COSTS OFF) SELECT * FROM my_property_secure v WHERE f_leak('passwd') AND f_leak(passwd); - QUERY PLAN ----------------------------------------------------------------------------- + QUERY PLAN +-------------------------------------------------------------------- Subquery Scan on v Filter: f_leak(v.passwd) -> Seq Scan on customer - Filter: (f_leak('passwd'::text) AND (name = (CURRENT_USER)::text)) + Filter: (f_leak('passwd'::text) AND (name = CURRENT_USER)) (4 rows) -- @@ -1409,15 +1409,15 @@ NOTICE: f_leak => 9801-2345-6789-0123 (1 row) EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_normal WHERE f_leak(cnum); - QUERY PLAN ------------------------------------------------------ + QUERY PLAN +--------------------------------------------- Hash Join Hash Cond: (r.cid = l.cid) -> Seq Scan on credit_card r Filter: f_leak(cnum) -> Hash -> Seq Scan on customer l - Filter: (name = (CURRENT_USER)::text) + Filter: (name = CURRENT_USER) (7 rows) SELECT * FROM my_credit_card_secure WHERE f_leak(cnum); @@ -1428,8 +1428,8 @@ NOTICE: f_leak => 1111-2222-3333-4444 (1 row) EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_secure WHERE f_leak(cnum); - QUERY PLAN ------------------------------------------------------------ + QUERY PLAN +--------------------------------------------------- Subquery Scan on my_credit_card_secure Filter: f_leak(my_credit_card_secure.cnum) -> Hash Join @@ -1437,7 +1437,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_secure WHERE f_leak(cnum); -> Seq Scan on credit_card r -> Hash -> Seq Scan on customer l - Filter: (name = (CURRENT_USER)::text) + Filter: (name = CURRENT_USER) (8 rows) -- @@ -1471,7 +1471,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_usage_normal -> Seq Scan on credit_card r_1 -> Hash -> Seq Scan on customer l_1 - Filter: (name = (CURRENT_USER)::text) + Filter: (name = CURRENT_USER) (13 rows) SELECT * FROM my_credit_card_usage_secure @@ -1502,7 +1502,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM my_credit_card_usage_secure -> Seq Scan on credit_card r_1 -> Hash -> Seq Scan on customer l - Filter: (name = (CURRENT_USER)::text) + Filter: (name = CURRENT_USER) (13 rows) -- |
