@ -142,6 +142,133 @@ SELECT b.*
4500 | 2080851358
(1 row)
--
-- Add coverage of RowCompare quals whose row omits a column ("proargtypes")
-- that's after the first column, but before the final column. The scan's
-- initial positioning strategy must become >= here (it's not the > strategy,
-- since the absence of "proargtypes" makes that tighter constraint unsafe).
--
explain (costs off)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE (proname, pronamespace) > ('abs', 0)
ORDER BY proname, proargtypes, pronamespace LIMIT 1;
QUERY PLAN
-------------------------------------------------------------------------------
Limit
-> Index Only Scan using pg_proc_proname_args_nsp_index on pg_proc
Index Cond: (ROW(proname, pronamespace) > ROW('abs'::name, '0'::oid))
(3 rows)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE (proname, pronamespace) > ('abs', 0)
ORDER BY proname, proargtypes, pronamespace LIMIT 1;
proname | proargtypes | pronamespace
---------+-------------+--------------
abs | 20 | 11
(1 row)
--
-- Similar to the previous test case, but this time it's a backwards scan
-- using a < RowCompare. Must use the <= strategy (and not the < strategy).
--
explain (costs off)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE (proname, pronamespace) < ('abs', 1_000_000)
ORDER BY proname DESC, proargtypes DESC, pronamespace DESC LIMIT 1;
QUERY PLAN
-------------------------------------------------------------------------------------
Limit
-> Index Only Scan Backward using pg_proc_proname_args_nsp_index on pg_proc
Index Cond: (ROW(proname, pronamespace) < ROW('abs'::name, '1000000'::oid))
(3 rows)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE (proname, pronamespace) < ('abs', 1_000_000)
ORDER BY proname DESC, proargtypes DESC, pronamespace DESC LIMIT 1;
proname | proargtypes | pronamespace
---------+-------------+--------------
abs | 1700 | 11
(1 row)
--
-- Add coverage for RowCompare quals whose rhs row has a NULL that ends scan
--
explain (costs off)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE proname = 'abs' AND (proname, proargtypes) < ('abs', NULL)
ORDER BY proname, proargtypes, pronamespace;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------
Index Only Scan using pg_proc_proname_args_nsp_index on pg_proc
Index Cond: ((ROW(proname, proargtypes) < ROW('abs'::name, NULL::oidvector)) AND (proname = 'abs'::name))
(2 rows)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE proname = 'abs' AND (proname, proargtypes) < ('abs', NULL)
ORDER BY proname, proargtypes, pronamespace;
proname | proargtypes | pronamespace
---------+-------------+--------------
(0 rows)
--
-- Add coverage for backwards scan RowCompare quals whose rhs row has a NULL
-- that ends scan
--
explain (costs off)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE proname = 'abs' AND (proname, proargtypes) > ('abs', NULL)
ORDER BY proname DESC, proargtypes DESC, pronamespace DESC;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------
Index Only Scan Backward using pg_proc_proname_args_nsp_index on pg_proc
Index Cond: ((ROW(proname, proargtypes) > ROW('abs'::name, NULL::oidvector)) AND (proname = 'abs'::name))
(2 rows)
SELECT proname, proargtypes, pronamespace
FROM pg_proc
WHERE proname = 'abs' AND (proname, proargtypes) > ('abs', NULL)
ORDER BY proname DESC, proargtypes DESC, pronamespace DESC;
proname | proargtypes | pronamespace
---------+-------------+--------------
(0 rows)
--
-- Add coverage for recheck of > key following array advancement on previous
-- (left sibling) page that used a high key whose attribute value corresponding
-- to the > key was -inf (due to being truncated when the high key was created).
--
-- XXX This relies on the assumption that tenk1_thous_tenthous has a truncated
-- high key "(183, -inf)" on the first page that we'll scan. The test will only
-- provide useful coverage when the default 8K BLCKSZ is in use.
--
explain (costs off)
SELECT thousand, tenthous
FROM tenk1
WHERE thousand IN (182, 183) AND tenthous > 7550;
QUERY PLAN
---------------------------------------------------------------------------------
Index Only Scan using tenk1_thous_tenthous on tenk1
Index Cond: ((thousand = ANY ('{182,183}'::integer[])) AND (tenthous > 7550))
(2 rows)
SELECT thousand, tenthous
FROM tenk1
WHERE thousand IN (182, 183) AND tenthous > 7550;
thousand | tenthous
----------+----------
182 | 8182
182 | 9182
183 | 8183
183 | 9183
(4 rows)
--
-- Add coverage for optimization of backwards scan index descents
--