Tasks: Float x Integer Btree Operator Family Integration

Input: Design documents from /specs/002-float-btree-ops/ Prerequisites: plan.md ✅, spec.md ✅, research.md ✅, data-model.md ✅, contracts/operators.md ✅, quickstart.md ✅

Format: [ID] [P?] [Story] Description

  • [P]: Can run in parallel (different files, no dependencies)
  • [Story]: Which user story this task belongs to (US1, US2, US3)
  • Include exact file paths in descriptions

Phase 1: Setup & Failing Tests

Purpose: Prepare test infrastructure and write failing tests BEFORE implementation (constitution.md requirement)

  • [X] T001 Create new regression test file sql/float_int_ops.sql with header comments and initial failing test stubs (merge join, catalog queries, transitivity) — record: the file already existed from 6e47d7f (2025-12-24); this feature appended to it, and the merge join tests went into sql/merge_joins.sql
  • [X] T002 [P] Create expected/float_int_ops.out with expected output (tests will FAIL until Phase 2 completes) — record: the file already existed from 6e47d7f; this feature appended to it
  • [X] T003 [P] Add float_int_ops to REGRESS list in Makefile — record: already in REGRESS since 6e47d7f; no change needed
  • [X] T003a Verify tests FAIL with make installcheck REGRESS=float_int_ops (constitution gate) — record: no artifact of the failing run exists

Phase 2: Foundational (Blocking Prerequisites)

Purpose: Core infrastructure that MUST be complete before ANY user story can be implemented

⚠️ CRITICAL: No user story work can begin until this phase is complete

  • [X] T004 Add int x float4 operators to float_ops btree family in pg_num2int_direct_comp–1.0.0.sql
  • [X] T005 Add int x float8 operators to float_ops btree family in pg_num2int_direct_comp–1.0.0.sql
  • [X] T006 Add float4/float8 same-type and cross-type operators to integer_ops btree family in pg_num2int_direct_comp–1.0.0.sql
  • [X] T007 Extend event trigger cleanup array with new btree family DROP statements in pg_num2int_direct_comp–1.0.0.sql — record: on 2026-11-29 the DROPs for the int x float entries were removed again. Those entries reference the extension’s own operators and functions, so DROP EXTENSION removes them by dependency; only the same-type entries that reference core operators (int x int in float_ops, float x float in integer_ops) still need a DROP
  • [X] T007a Add GUC parameter pg_num2int_direct_comp.enable_support_functions with DefineCustomBoolVariable in _PG_init() — renumbered from a duplicate T008; record: it was registered as enableSupportFunctions until fix/002-verify-tasks (2026-11-27), which also reserves the prefix
  • [X] T007b [P] Add GUC checks to SupportRequestSimplify and SupportRequestIndexCondition functions — renumbered from a duplicate T009; record: the SupportRequestIndexCondition handler was later removed by feature 003 (a5851c9), so only the Simplify check remains
  • [X] T007c Add MERGES property to all equality operators to enable merge join optimization — renumbered from a duplicate T010; record: =(int2,float4), =(int2,float8) and =(int4,float8) lacked MERGES until 3737329 (2026-11-25)

Checkpoint: Btree family registration complete - user story testing can now begin


Phase 3: User Story 1 - Merge Joins for Integer x Float Columns (Priority: P1) 🎯 MVP

Goal: Enable merge join optimization for queries joining tables on integer and float columns

Independent Test: Create indexed tables with integer and float columns, execute join queries with enable_hashjoin=off and enable_nestloop=off, verify EXPLAIN shows Merge Join

Tests for User Story 1

  • [X] T008 [US1] Add merge join test for int4 x float4 in sql/merge_joins.sql (verify EXPLAIN shows Merge Join) — record: originally said sql/float_int_ops.sql; the test lives in merge_joins.sql
  • [X] T009 [P] [US1] Add merge join test for int4 x float8 in sql/merge_joins.sql
  • [X] T010 [P] [US1] Add merge join test for int8 x float4 in sql/merge_joins.sql
  • [X] T011 [P] [US1] Add merge join test for int8 x float8 in sql/merge_joins.sql
  • [X] T012 [US1] Add pg_amop catalog verification query for float_ops btree in sql/float_int_ops.sql (whole family: 95 = 20 built-in + 15 int same-type + 60 int x float; plus a per-pair completeness check that lists incomplete pairs) — record: 1.0.1 (2026-11-30) adds the 30 cross-width int x int operators to float_ops, so the whole family is now 125; see sql/cross_width_chains.sql — record: 2026-11-30 the whole-family COUNT is removed (it counted core entries; extension_lifecycle’s footprint counts the extension’s own), and the per-pair check also checks which operator holds each strategy; a family-wide strategy/operator check covers float_ops, integer_ops and numeric_ops
  • [X] T014 [P] [US1] Add pg_amop catalog verification query for integer_ops btree float entries in sql/float_int_ops.sql (70 float entries: 10 float same-type + 60 int x float; whole family 150; covered by the same per-pair check) — T013 was removed as a duplicate of T012: PostgreSQL has one float_ops family — record: 1.0.1 (2026-11-30) adds float4 x float8 (10 operators), so the whole family is now 160 — record: 2026-11-30 the whole-family COUNT is removed, as for T012
  • [X] T014a [P] [US1] Add pg_operator verification query to confirm MERGES property on equality operators (FR-008) — record: the original query was a count snapshot that recorded the missing MERGES as correct; since 2026-11-27 it lists int x float = operators lacking MERGES, expected none — record: 2026-11-30 the query starts from the 12 expected pairs, so a missing = is listed too
  • [X] T015 [US1] Run regression test and capture expected/float_int_ops.out

Checkpoint: Merge join functionality verified - US1 complete


Phase 4: User Story 2 - Mathematical Transitivity Verification (Priority: P1)

Goal: Validate that exact comparison operators satisfy btree transitivity requirements

Independent Test: Create chained equality conditions, verify planner transitive inference, prove exact comparison semantics preserve transitivity for stored float values

Tests for User Story 2

  • [X] T016 [US2] Add transitivity test for int4 = float4 = int4 chain in sql/float_int_ops.sql (stored float4 values at and above 224: at most one int equals each, and the chain implies a = c) — record: the first version used the constant 42 throughout and could not fail; rewritten 2026-11-27. On 2026-11-29 the separate transitive column was dropped: the candidates are distinct integers, so the chain implying a = c follows from ints_equal <= 1, which is now the only check
  • [X] T017 [P] [US2] Add transitivity test for int8 = float8 = int8 chain in sql/float_int_ops.sql (same method at 253) — record: rewritten 2026-11-27, as T016; transitive column dropped 2026-11-29, as T016
  • [X] T017a [P] [US2] Add transitivity test for int8 = float4 = int8 chain in sql/float_int_ops.sql (same method, from 224 to the largest float4 below 263) — record: added 2026-11-29; the third pair whose int type is wider than the float mantissa had no transitivity test
  • [X] T018 [P] [US2] Add NaN transitivity test (NaN = NaN, NaN > all non-NaN) in sql/float_int_ops.sql (all 6 float x int pairs, both operand orders, min/-1/0/1/max) — record: the first version sampled one value for 2 pairs; extended 2026-11-27. On 2026-11-29 the per-pair SELECTs were replaced by a pointer to sql/comparison_exactness.sql Check 3, which checks NaN for all 6 pairs, all six operators and both operand orders, column vs column, against the exact reference; only NaN = NaN stays in float_int_ops
  • [X] T019 [P] [US2] Add +/-Infinity ordering test (-Inf < all ints < +Inf) in sql/float_int_ops.sql (all 6 pairs, both operand orders) — record: extended 2026-11-27 from 2 pairs; it checked = only as -Inf = n and n = Inf. On 2026-11-29 moved to comparison_exactness Check 3 with T018 (ex_float gained Infinity::float8 and -Infinity::float4), so every operator is checked against both infinities in both operand orders
  • [X] T020 [US2] Add precision boundary transitivity test (16777216 boundary for float4) in sql/float_int_ops.sql
  • [X] T020a [US2] Add EXPLAIN test for transitive inference (verify planner simplifies chained conditions) in sql/float_int_ops.sql
  • [X] T021 [US2] Update expected/float_int_ops.out with transitivity test results

Checkpoint: Transitivity proven - US2 complete


Phase 5: User Story 3 - Documentation Clarity and Persuasiveness (Priority: P2)

Goal: Reduce documentation by 20% word count while addressing “non-standard operators” concern

Independent Test: Measure word count before/after, verify doc-example-reviewer reports 100% compliance

Implementation for User Story 3

  • [X] T022 [US3] Measure baseline word count for README.md and doc/.md (target: reduce from 11,234 to ≤8,987) — record: wc -w README.md doc/*.md at 1ebe0d6 gives 11,233*
  • [X] T023 [US3] Update README.md: add “Why Custom Operators?” section addressing non-standard concern — record: no heading by that name; the concern is answered by the FAQ entries “Why not just fix the application to use consistent types?” and “What’s the risk of custom operators?”
  • [X] T024 [US3] Update README.md: remove duplicate precision loss explanations
  • [X] T025 [US3] Update README.md: add equivalence expressions section (with/without extension)
  • [X] T026 [US3] Update README.md: update Limitations section to reflect merge join support for int x float
  • [X] T026a [US3] Update README.md: add GUC configuration section documenting pg_num2int_direct_comp.enable_support_functions
  • [X] T027 [P] [US3] Update doc/api-reference.md: add float btree family information concisely — record: doc/api-reference.md was merged into doc/operator-reference.md in 0903430 (2026-01-15); the information is there
  • [X] T028 [P] [US3] Update doc/operator-reference.md: add float operators to tables
  • [X] T029 [US3] Add all README SQL examples to sql/doc_examples.sql per constitution.md
  • [X] T029a [US3] Add GUC usage examples to sql/doc_examples.sql (enable/disable, SHOW command)
  • [ ] T030 [US3] Run doc-example-reviewer skill to verify 100% compliance — unchecked 2026-11-27: no review record exists, and the README GUC example did not match its test output until fix/002-verify-tasks. The examples are covered in sql/doc_examples.sql, but the reviewer has not been run
  • [ ] T031 [US3] Measure final word count and verify ≥20% reduction — unchecked 2026-11-27: target not met. wc -w README.md doc/*.md gives 11,645 at the feature merge (10f1844, +3.7%) and 9,922 at 394a675 (−11.7%) against a target of ≤8,987

Checkpoint: Documentation reduced and examples tested - US3 complete


Phase 6: Polish & Cross-Cutting Concerns

Purpose: Validation and cleanup across all user stories

  • [X] T032 [P] Add extension lifecycle test (DROP/CREATE cycle) for float btree families in sql/extension_lifecycle.sql
  • [X] T032a [P] Add GUC configuration testing to sql/extension_lifecycle.sql (SHOW, SET, enable/disable verification)
  • [X] T033 [P] Update expected/extension_lifecycle.out with new cleanup verification
  • [X] T034 Run full regression suite: make installcheck
  • [X] T035 Verify all pg_amop entries removed after DROP EXTENSION via catalog query — record: until 2026-11-27 the query covered only the int x float entries; it now also covers the int same-type entries in float_ops and the float same-type entries in integer_ops. On 2026-11-29 the hand-written queries were replaced by a diff of the whole pg_amop/pg_amproc catalog against a snapshot taken in a fresh template0 database before the first install (all access methods and families), plus reinstall and upgrade-path comparisons
  • [X] T036 Run quickstart.md validation: execute all code blocks and verify expected output — record: quickstart.md used the nonexistent float4_ops family and listed the deleted doc/api-reference.md until 2026-11-27; the merge join block was re-run then and shows Merge Join

Dependencies & Execution Order

Phase Dependencies

  • Phase 1 (Setup): No dependencies - start immediately
  • Phase 2 (Foundational): Depends on Phase 1 - BLOCKS all user stories
  • Phase 3-5 (User Stories): All depend on Phase 2 completion
    • US1 and US2 are both P1 and can run in parallel
    • US3 (P2) can run in parallel with US1/US2 or after
  • Phase 6 (Polish): Depends on Phase 2 minimum; ideally after all stories

Within Each User Story

  • Tests written first (constitution.md test-first requirement)
  • Tests must FAIL before implementation (already done in Phase 2)
  • Update expected output after test runs pass

Parallel Opportunities

Phase 1: T002, T003 can run in parallel with T001 Phase 3: T009-T011 can run in parallel; T014-T014a can run in parallel Phase 4: T017-T019 (including T017a) can run in parallel Phase 5: T027-T028 can run in parallel Phase 6: T032-T033 can run in parallel


Implementation Strategy

MVP First (User Stories 1 + 2)

  1. Complete Phase 1: Setup
  2. Complete Phase 2: Foundational (SQL implementation)
  3. Complete Phase 3: User Story 1 (merge join tests)
  4. Complete Phase 4: User Story 2 (transitivity tests)
  5. STOP and VALIDATE: Run make installcheck - all tests pass
  6. Merge to main if documentation update not critical

Full Delivery

  1. Complete MVP (Phases 1-4)
  2. Complete Phase 5: User Story 3 (documentation)
  3. Complete Phase 6: Polish
  4. Final validation: all tests pass, word count reduced, doc-example-reviewer clean

Summary

Phase Task Count Purpose
Setup 4 Test infrastructure (T001-T003a)
Foundational 7 SQL implementation, GUC, MERGES (T004-T007c)
US1 - Merge Joins 8 Core functionality tests (T008-T015; T013 removed)
US2 - Transitivity 8 Correctness verification (T016-T021)
US3 - Documentation 12 Word reduction + examples (T022-T031)
Polish 6 Cross-cutting validation (T032-T036)
Total 45 43 done, 2 open (T030, T031)

Parallel Opportunities

  • Phase 1: 2 tasks parallelizable
  • Phase 3: 6 tasks parallelizable
  • Phase 4: 3 tasks parallelizable
  • Phase 5: 2 tasks parallelizable
  • Phase 6: 2 tasks parallelizable

MVP Scope

User Stories 1 + 2 (Phases 1-4): 21 tasks → Core merge join functionality with transitivity proof

Format Validation

✅ All tasks follow checklist format: - [ ] [TaskID] [P?] [Story?] Description with file path