Skip to content

test: sorted_projection gets its pytest twin, its index lookups read the index, and each refusal must be its own (#1341, #1339) - #1506

Merged
jdatcmd merged 6 commits into
mainfrom
test/1341-sorted-projection-twin
Oct 16, 2026
Merged

jdatcmd merged 6 commits into
mainfrom
test/1341-sorted-projection-twin

Conversation

@OffgridwithJD

Copy link
Copy Markdown
Collaborator

@jdatcmd The sixth #1339 custom-scan audit entry, done as a twin PR because sorted_projection.sh had none. Stacked on #1504 (#1503 → #1504 → this). This PR's own commits are the top two.

Three shell defects, each measured red first

arm mutation old suite new suite = twin
"index point lookup after sort" post-sort reindex removed (columnar_vacuum.c), so the index points at the old row numbers green: it never read the index red
"reject non-columnar table" vacuum_sorted's columnar check removed green: the heap table still raised, as XX001 reading the heap's file as columnar storage red
any expect_error arm going red (by construction) recorded as "<label> (expected error)", a name the passing run never records, so its ledger row could never be dated recorded under the label

Fixes:

  • The index lookups turn the custom scan off, with a premise each that they read t_col_id_idx. The count plans as an Index Only Scan, so the premise accepts either index node.
  • Each refusal requires its own SQLSTATE: 42809, 42703, 22023 and 42883, measured at head.

The twin

All 29 checks by the shell's name, in three tests, porting pgc_check_ordered_oracle and the set and sequence hashes. Under each mutation (reindex removed, no sort, columnar check removed) it reddens exactly the shell's set. The no-sort mutation also reddens the json refusal, because that refusal is raised by setting up the sort.

Five-major runs at head: 29/29 for the shell and 29/29 for the twin, on each of 15–19.

Ledger

Census 4377 / 3053 never / 1324 dated (on #1504's 4348 / 3029 / 1319), with suites_not_covered 192 → 191. 5 of the 29 checks are dated. The gate gives rc 0. Collection gives cluster_tests 744 -> 747, and TESTS.md gets §174. The loop-reader list gains the suite, the grader passes 40/40, and the guards 438/438.

That leaves audit.sh as the last audit entry.

🤖 Generated with Claude Code

jdatcmd and others added 6 commits October 16, 2026 18:11
…dium projections assert their plans (#1341, #1339)

test_native_fetch_bigcap.py carries all 15 checks by the shell's name in
two tests, measuring buffers as the shell's awk sums them.

Two premises are new, in both twins: the narrow (sum(tag)) and medium
(m1 || m2 || m3) projections are fetched through an index scan. Only the
payload query's plan was asserted. Both plan as Index Scans today, so these
guard against a planner change rather than fix a red. FORCE_INDEX also turns
the custom scan off, which enable_seqscan does not (#1339).

Measured and left alone:
- "the fetched rows are the right rows" compares an unforced read with an
  ORDER BY id LIMIT 10 read, which take different paths, so it reddens when
  the deferred decode corrupts a column (shell and twin). Forcing both sides
  through the index made it agree with itself, so it stays as it was.
- the two #433 ratios do not move when the cache misses every lookup or the
  cap drops every column, because those re-read only the projected columns.
  #433's own regression re-read the group's raw bytes per fetch, and there is
  no single-gate mutation for that here.

COMPLETE gains native_fetch_bigcap. TESTS.md section 173, cluster_tests
742 -> 744.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…by a deferred-decode mutation (#1341)

The suite had no rows. suites_not_covered 193 -> 192; census 4347 rows /
3031 never / 1316 dated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"the primary key finds a moved row at its new key, and not at its old one,
as on heap" forced the index with enable_seqscan off alone, which leaves the
columnar custom scan on. Measured: with pgcolumnar_index_fetch_tuple finding
no row, the arm stayed green, because the columnar parent was answered by its
partitions' custom scans. IDX now also turns the custom scan off, and a
premise asserts the columnar lookup reads the primary key. It plans as an
Index Only Scan, which on a columnar table still asks each row whether it is
live, so the premise accepts either index node. With the same mutation the
arm is now red, in both twins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te-key arms are dated (#1339)

Census 4348 rows / 3029 never / 1319 dated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the index, and each refusal must be its own (#1341, #1339)

test_sorted_projection.py carries all 29 checks by the shell's name in
three tests. Under each of four mutations the twin reddens exactly the
shell's set: the post-sort reindex removed, the compaction not sorting, and
vacuum_sorted's columnar check removed.

Three shell changes, each measured red first:
- "index point lookup after sort" set only enable_seqscan off. With the
  reindex removed, so the index points at the old row numbers, it stayed
  green: it never read the index. The lookups now turn the custom scan off,
  with a premise each that they read t_col_id_idx (an Index Scan or, for the
  count, an Index Only Scan).
- "reject non-columnar table" counted any error. With vacuum_sorted's
  columnar check removed, the heap table still raised -- XX001, reading the
  heap's file as columnar storage -- and the arm stayed green. Each refusal
  now requires its own SQLSTATE (42809, 42703, 22023, 42883).
- expect_error recorded a red as "<label> (expected error)", a name the
  passing run never records, so the ledger's row could not be dated by it.
  It records under the label.

COMPLETE gains sorted_projection, and its literal tables join the
loop-reader guard's list. TESTS.md section 174, cluster_tests 744 -> 747.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… vacuum_sorted mutations (#1341)

The suite had no rows. suites_not_covered 192 -> 191; census 4377 rows /
3053 never / 1324 dated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@jdatcmd jdatcmd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve, at 332435e (its own commits, on #1504).

My own mutant, different from your three: vacuum_sorted's unknown-column refusals raise 22023 instead of 42703 (all four ERRCODE_UNDEFINED_COLUMN sites in columnar_vacuum.c). PG17:

  • shell: reject unknown column: got [22023] want [42703];
  • pytest: the same.

That's what the per-refusal SQLSTATE buys. The old "any error" form would have stayed green under it. The (expected error) naming fix, recording a red under its own label, is the right one too: a name the passing run never records can't be dated.

@jdatcmd

jdatcmd commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

@OffgridwithJD, merging #1506 now: approved at 332435e, 15/15 green, CLEAN.

@jdatcmd
jdatcmd merged commit 7a5f16e into main Oct 16, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants