Most of these tests have been introduced in 6dd8b00807, to check for
behaviors related to hashing and hash plans, and money is a data type
with btree support but no hash functions. These tests are switched to
use varbit instead, to provide the same coverage.
Some other tests historically used money but don't really need it for
what they wanted to test (see rules.sql). Plans and coverage are
unchanged after the modifications done here.
Support for money may be removed a a later point, but this needs more
discussion.
Discussion: https://postgr.es/m/18240-c5da758d7dc1ecf0@postgresql.org
select x from (values (100::money), (200::money)) _(x) union select x from (values (100::money), (300::money)) _(x);
select x from (values ('11'::varbit), ('10'::varbit)) _(x) union select x from (values ('11'::varbit), ('10'::varbit)) _(x);
QUERY PLAN
QUERY PLAN
-----------------------------------------------
-----------------------------------------------
Unique
Unique
@ -492,7 +492,7 @@ select x from (values (100::money), (200::money)) _(x) union select x from (valu
set enable_hashagg to off;
set enable_hashagg to off;
explain (costs off)
explain (costs off)
select x from (values (100::money), (200::money)) _(x) union select x from (values (100::money), (300::money)) _(x);
select x from (values ('11'::varbit), ('10'::varbit)) _(x) union select x from (values ('11'::varbit), ('10'::varbit)) _(x);
QUERY PLAN
QUERY PLAN
-----------------------------------------------
-----------------------------------------------
Unique
Unique
@ -563,7 +563,7 @@ select x from (values (array[1, 2]), (array[1, 3])) _(x) except select x from (v
-- non-hashable type
-- non-hashable type
explain (costs off)
explain (costs off)
select x from (values (array[100::money]), (array[200::money])) _(x) union select x from (values (array[100::money]), (array[300::money])) _(x);
select x from (values (array['10'::varbit]), (array['11'::varbit])) _(x) union select x from (values (array['10'::varbit]), (array['01'::varbit])) _(x);
QUERY PLAN
QUERY PLAN
-----------------------------------------------
-----------------------------------------------
Unique
Unique
@ -574,12 +574,12 @@ select x from (values (array[100::money]), (array[200::money])) _(x) union selec
-> Values Scan on "*VALUES*_1"
-> Values Scan on "*VALUES*_1"
(6 rows)
(6 rows)
select x from (values (array[100::money]), (array[200::money])) _(x) union select x from (values (array[100::money]), (array[300::money])) _(x);
select x from (values (array['10'::varbit]), (array['11'::varbit])) _(x) union select x from (values (array['10'::varbit]), (array['01'::varbit])) _(x);
x
x
-----------
------
{$100.00}
{01}
{$200.00}
{10}
{$300.00}
{11}
(3 rows)
(3 rows)
set enable_hashagg to off;
set enable_hashagg to off;
@ -710,7 +710,7 @@ select x from (values (row(1, 2)), (row(1, 3))) _(x) except select x from (value
-- With an anonymous row type, the typcache does not report that the
-- With an anonymous row type, the typcache does not report that the
-- type is hashable. (Otherwise, this would fail at execution time.)
-- type is hashable. (Otherwise, this would fail at execution time.)
explain (costs off)
explain (costs off)
select x from (values (row(100::money)), (row(200::money))) _(x) union select x from (values (row(100::money)), (row(300::money))) _(x);
select x from (values (row('10'::varbit)), (row('11'::varbit))) _(x) union select x from (values (row('10'::varbit)), (row('01'::varbit))) _(x);
QUERY PLAN
QUERY PLAN
-----------------------------------------------
-----------------------------------------------
Unique
Unique
@ -721,19 +721,19 @@ select x from (values (row(100::money)), (row(200::money))) _(x) union select x
-> Values Scan on "*VALUES*_1"
-> Values Scan on "*VALUES*_1"
(6 rows)
(6 rows)
select x from (values (row(100::money)), (row(200::money))) _(x) union select x from (values (row(100::money)), (row(300::money))) _(x);
select x from (values (row('10'::varbit)), (row('11'::varbit))) _(x) union select x from (values (row('10'::varbit)), (row('01'::varbit))) _(x);
x
x
-----------
------
($100.00)
(01)
($200.00)
(10)
($300.00)
(11)
(3 rows)
(3 rows)
-- With a defined row type, the typcache can inspect the type's fields
-- With a defined row type, the typcache can inspect the type's fields
-- for hashability.
-- for hashability.
create type ct1 as (f1 money);
create type ct1 as (f1 varbit);
explain (costs off)
explain (costs off)
select x from (values (row(100::money)::ct1), (row(200::money)::ct1)) _(x) union select x from (values (row(100::money)::ct1), (row(300::money)::ct1)) _(x);
select x from (values (row('10'::varbit)::ct1), (row('11'::varbit)::ct1)) _(x) union select x from (values (row('10'::varbit)::ct1), (row('01'::varbit)::ct1)) _(x);
QUERY PLAN
QUERY PLAN
-----------------------------------------------
-----------------------------------------------
Unique
Unique
@ -744,12 +744,12 @@ select x from (values (row(100::money)::ct1), (row(200::money)::ct1)) _(x) union
-> Values Scan on "*VALUES*_1"
-> Values Scan on "*VALUES*_1"
(6 rows)
(6 rows)
select x from (values (row(100::money)::ct1), (row(200::money)::ct1)) _(x) union select x from (values (row(100::money)::ct1), (row(300::money)::ct1)) _(x);
select x from (values (row('10'::varbit)::ct1), (row('11'::varbit)::ct1)) _(x) union select x from (values (row('10'::varbit)::ct1), (row('01'::varbit)::ct1)) _(x);