queryfixtures

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package queryfixtures holds SQL texts that more than one test package must run VERBATIM.

A text lives here only when two packages assert about the SAME statement and one of them is the other's precondition — a census pinned over a plan is a statement about the query that produced it, so it is worth nothing if the query drifts. Keeping the two copies in step used to be a comment asking the next editor to remember; a shared constant makes it the compiler's job, which is the only version that survives an edit made in one package by someone who has never opened the other.

Index

Constants

View Source
const DuplicateNameJoinQuery = "WITH d AS (SELECT id AS bid, EXISTS (SELECT 1 FROM b_md AS x WHERE x.id = b_md.id) AS foo FROM b_md) " +
	"SELECT * FROM a_md AS a JOIN d ON a.id = d.bid FULL OUTER JOIN c_md AS c ON a.id + 1 = c.id"

DuplicateNameJoinQuery is a FULL OUTER JOIN whose result row names `ID` twice, once from each id leg (`SELECT *` over legs that both carry it).

Such a row's synthesized descriptor cannot validate. Registration must roll back that root, leaving other constructors stampable. The embedded plan census checks this containment; the FDB test checks both distinct ordinal ID slots.

What this text does NOT carry is the struct claim. It selects the columns of a_md, d and c_md and has no struct column, computed or stored, so nothing about raw maps versus api.Struct can be read off it. That cost is measured by three OTHER texts in the same FDB test, which are not shared and do not belong here. Attaching the struct claim to this constant once made it describe a plan that cannot exhibit it.

Two packages pin what this text does carry: one asserts the descriptor census over the baked plan, the other reads the whole outer-join result back out of a real store and checks every row arrives with both `ID` slots. The census is that row-arrival read's precondition — and only that read's; the census pin says in as many words that it asserts nothing about the struct texts. Sharing the constant is what keeps the two halves measuring one plan.

The `a.id + 1 = c.id` predicate is load-bearing: it keeps the two `ID` slots holding DIFFERENT values, so a read that took one slot twice would be caught. Under an equality predicate both slots are equal and the check cannot discriminate.

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL