Status: implemented on both catalog stores (proposed 2026-11-25,
built 2026-11-30). The server resolves namespace, table, view and column
names after folding ASCII case and answers with the stored spelling. The
refusal of new colliding names is staged behind
HOGLAKE_REFUSE_COLLIDING_NAMES (default off), and the unique indexes of
the last rollout step are not built. This document is the
change, the reasons for it, and the order to ship it in. Operators read
server/README.md §Identifier case.
Companions: README.md (architecture), trino-integration.md (the connector whose lowercasing drives this), iceberg-federation.md (the facade that will export these names), ../duckdb-client/DESIGN.md §Identifier case (the client-side bridge this replaces), auth-tenancy.md §6.2c and §6.2d (the two places that already fold case).
hoglake identifiers become case-preserving and case-insensitive (CPCI), and the server enforces it:
- Stored as written.
EventsstaysEvents. - Unique after folding. No two live siblings are equal once ASCII
A-Zis folded toa-z: namespaces in a catalog, tables and views in a namespace (one scope for both), columns under one parent at every nesting level. - Resolved by the server. A lookup takes the exact match if there is one, otherwise the one fold-equal name. Two fold-equal names and no exact match is a typed refusal, never a guess.
- Returned as stored. A response carries the stored spelling, whatever the request spelled, except where the path names the object under another name of its own: a served namespace, a stream table and a remote schema (What a response carries).
- The fold is ASCII only. It is the same function in Kotlin, Python, C++, Java, PostgreSQL and SQLite. That holds because the identifier alphabet is ASCII; widening the alphabet reopens this decision.
- Files bind by field id, as now. Names in a Parquet footer decide nothing except in files that carry no ids, and those bind by fold-equal name on the server as they already do in truffle.
hoglake has three stated goals, and each one meets an engine that changes the case of names before it compares them.
| Goal | What folds | What hoglake has to guarantee |
|---|---|---|
| Served by truffle | Trino lowercases every schema, table and column name, quoted or not | A lowercased name finds the object, and no two objects share a lowercased name |
| An open table format | Spark, DuckDB and Databricks resolve columns case-insensitively; Hive, Glue and Unity Catalog store names lowercased; Snowflake uppercases | The format states one rule, so two readers cannot disagree about which column a name means |
| Iceberg interoperability | The Iceberg spec has no case rule; its engines each apply their own | An exported table is readable by engines that fold, not only by engines that do not |
One property serves all three: names stay distinct under any engine's fold. Uniqueness after folding is that property. Preserving the stored case costs nothing on top of it, and lowercasing on store would discard spelling that DuckDB, Spark and Python users see.
Read from this repository and from PostHog/truffle at 7fb1767
(2026-11-25), before any of this was built; the present tense below is
that date's. The Trino behaviour is read from the connector's source,
not run.
-
Names are case-sensitive and case-preserving. They match
^[A-Za-z_][A-Za-z0-9_-]{0,127}$(Identifiers.PATTERN). The live-name indexes are on the exact text (hog_namespace_live_name,hog_table_version_live_name,hog_view_live_name), soEventsandeventscoexist. Sibling column names are checked for exact duplicates in the service only (ColumnTrees,AlterService); no index covers them. -
A table and a view can share a name, even spelled the same. On both backends
createTablelooks only at tables andcreateViewonly at views. Read from the code, not run. -
Trino cannot address a mixed-case name. The SPI lowercases in
SchemaTableName,ColumnMetadataandColumnSchema. The connector sends that lowercased name (HoglakeMetadata.getTableHandle), and the server'stv.name = :namedoes not matchEvents. The table is listed and cannot be queried. -
Case-colliding columns are unreadable in Trino. Trino's Parquet footer reader lowercases field names, so the connector refuses a file whose bound column has a case twin: "Names that differ only by case are not supported" (
HoglakePageSourceProvider.checkNoCaseCollision). Field-id binding does not save such a file. -
The connector builds write paths from lowercased names.
HoglakeMetadata.tableWritePathjoins Trino's schema and table names intodata/<namespace>/<table>/, while the server spells the table root with the stored names (ObjectPrefix.tableRoot). -
The server and truffle bind id-less files differently. For a file field without a field id, truffle falls back from the exact name to a match that ignores case. The server's hydrator and compaction match the exact name only (
FooterStats.bindIndex). Ingestion and file registration has the consequence. -
Four places already patched this on their own, each differently.
Where What it does duckdb-client Resolves every name case-insensitively against a listing and sends the server's spelling; reports case-only pairs as ambiguous ReservedNamespacesFolds ASCII A-Zbefore comparingTeamNamespaces.hasShapeMatches team_<digits>in any ASCII caseVariantShreddingRefuses fields that differ only by case, using the JDK's lowercase(); pyhoglake carries aΣcarve-out because Python and the JDK fold differently -
truffle's other lake connectors chose list-and-match. Its DuckLake connector lowercases and fails on "multiple tables differ only in case"; Trino's Iceberg REST catalog has
iceberg.rest-catalog.case-insensitive-name-matching, which lists remote names and caches a lowercase-to-remote map.
Not known: how many mixed-case names and case-only pairs production holds. The audit queries answer it, and the answer sets how much of the rollout is needed.
Read on 2026-11-25 from each project's default branch or documentation.
| System | Stored | Resolution | Case-only duplicates |
|---|---|---|---|
| Iceberg spec, Iceberg REST spec | As written | Not stated; data binds by field id | Not addressed |
| Iceberg Java library | As written | Case-sensitive by default | Accepted; the first case-insensitive lookup throws |
| Delta protocol | As written | Case-insensitive | Refused |
| DuckLake spec | As written | Not stated | Not addressed |
| DuckDB and its DuckLake extension | As written | Case-insensitive, quoted or not; ASCII fold | Refused |
| Hive Metastore, AWS Glue, Athena | Lowercased | Case-insensitive | Cannot exist |
| Unity Catalog | Object names lowercased; column case kept | Case-insensitive | Cannot exist for objects |
| Lakekeeper (namespaces, tables, views) | As written | Case-insensitive, ICU collation | Refused |
| Apache Polaris | As written | Case-sensitive | Accepted |
| Paimon | As written | Per catalog: case-sensitive |
Depends on the option |
| Trino | Lowercased by the engine | Case-insensitive | AMBIGUOUS_COLUMN_NAME |
| Spark (default) | As written | Case-insensitive | Refused |
| Snowflake | Unquoted names uppercased | Exact after folding | Accepted through quoting |
| Flink, ClickHouse | As written | Case-sensitive | Accepted |
| Parquet | As written | Exact string | Not rejected by parquet-java |
What the survey shows:
- The specs that say nothing are where the interop bugs are.
Iceberg's Java library builds a schema holding
dataandDATA, then fails with "Cannot build lower case index: data and DATA collide" on the first case-insensitive lookup. A request for case-insensitive matching in the REST client was closed as not planned (apache/iceberg#14386). - Delta wrote the column rule down. "All column names must be unique regardless of casing"; its documentation calls the schema "case-preserving but insensitive".
- Lakekeeper applied the same rule to namespaces and tables, in the catalog, so that it is "transparent to all query engines — no client-side configuration is needed". Polaris, which is case-sensitive, has an open request for a case-insensitive mode because users arriving from Hive "hit 'not found' errors or create duplicate tables" (apache/polaris#5842).
- Trino is not about to change. trinodb/trino#17, "Add support for case sensitive identifiers", has been open since 2019.
- Tables and views share one name scope in Iceberg's catalogs.
Creating a view where a table has the name fails with "Table with
same name already exists",
and the reverse with "View with same name already exists". SQL
engines have one relation namespace for the same reason:
FROM ns.xcannot say which it means. - A Unicode-aware fold is a second interop problem. Lakekeeper
documents that Trino's Java case rules disagree with its ICU collation
on letters such as the dotless
ı. DuckDB folds ASCII only, and so does the Unity Catalog OSS Delta API ("equal under ASCII lowercase comparison"). - Lowercase-only catalogs exist downstream. Iceberg's Glue client
rejects, by default, any table name outside
^[a-z0-9_]{1,255}$. A catalog whose names are unique after folding can be lowercased for such a target without a collision.
The Iceberg, Delta, Lakekeeper, Glue, Trino, DuckDB, DuckLake, Hive, Polaris, Paimon, parquet-java, Unity Catalog and Athena rows were checked against the source file or documentation page. The Spark, Snowflake, Flink and ClickHouse rows come from one survey pass over their documentation and were not re-checked.
| Covered | Not covered, and why |
|---|---|
| Namespace names | Catalog names: lowercase-only already (CATALOG_NAME_PATTERN) |
| Table names | Keys inside VARIANT, JSON and MAP values: they are data, and status and Status stay two keys |
| View names | Property keys, consumer names, mount names: no engine folds them |
| Column names, including struct fields at every depth | Object paths and partition values: bytes, compared exactly |
List and map children keep their fixed names (element, key,
value).
VARIANT shredding declarations keep the rule they have. A declaration already refuses two fields that differ only by case, because each shredded field becomes a file column and truffle's reader lowercases column names. That check folds as the JDK does, to match the reader, and it limits only what may be shredded: the values keep both keys.
fold(name) replaces each of ASCII A-Z with a-z and changes
nothing else. Two names are fold-equal when their folds are equal.
- The identifier alphabet is ASCII, so on a valid name every implementation below agrees. The fold is still defined on any string, because a lookup folds a name before anything has validated it.
- A general lowercase is wrong here. Kotlin's
lowercase()maps the Kelvin signK(U+212A) tok, so a request forKwould resolve to tablek.ReservedNamespacesTestalready records this. - Widening the alphabet reopens this decision. Trino lowercases
names with Unicode rules (
toLowerCase(ENGLISH)), so under an ASCII foldÉandéwould be two legal columns that truffle reads as one. No Unicode fold is the same in every runtime below, either. The rule is sound only while names are ASCII. - truffle's reader maps three non-ASCII names the fold does not.
It matches an id-less footer name after lowercasing it with
Locale.ENGLISHand comparing ignoring case, which also equates the Kelvin sign (U+212A) withk, the long s (U+017F) withsand the dotless ı (U+0131) withi. The server does not widen its fold to match. A column that only that mapping would bind to an id-less field binds nothing, and is treated as an ambiguous match (Ingestion). VariantShreddingkeeps its own fold, on purpose. It compares the names of shredded fields, which are JSON keys and may hold any Unicode, and it folds them as truffle's Parquet reader does, with the JDK'slowercase(). An ASCII fold there would admitÉandéas two shredded fields that the reader takes for one. The two folds give the same answer on every string the identifier pattern admits, so identifiers have one rule. The two are not to be merged: the shredding check moves toIdentifiers.foldonly if the reader stops lowercasing footer names.
| Where | The fold |
|---|---|
| Kotlin | Identifiers.fold, moved from ReservedNamespaces.fold |
| PostgreSQL | lower(name COLLATE "C") |
| SQLite (Hoglite) | COLLATE NOCASE on the comparison |
| Python, C++, Java | An ASCII loop; never str.lower() or toLowerCase() |
Among live siblings, no two names are fold-equal.
| Kind | Siblings | Live means |
|---|---|---|
| Namespace | Same catalog | NOT dropped |
| Table or view | Same namespace, tables and views together | Table: live version row, table not dropped. View: end_snapshot IS NULL |
| Column | Same table and same parent | end_snapshot IS NULL |
- Tables and views are one scope. A table cannot take a name
fold-equal to a live view's, nor a view a table's, including the same
spelling. This was new on its own account: before this change the two
were checked separately. Like every other new collision, the
same-spelling case is staged behind the flag (kind
table_view), and an exact duplicate of the same kind is refused regardless. Lookups do not change, because a table route reads tables and a view route reads views. - The set visible at any snapshot was once the live set, so the property holds at every snapshot taken after the rule ships.
- A dropped name can be reused in another case: drop
Events, createevents. This rests on an invariant the exact-name index already needs: a drop ends the table's live version row in the transaction that setsdropped_snapshot(TableRepo.markDropped, the only PostgreSQL writer of that column). - A rename that changes only the case of the object itself is legal. The check excludes the object by id, not by name. The API renames tables and columns only; it has no namespace or view rename.
- Pairs that exist before the rule ships are left as they are, and new
ones are still accepted while the refusal is staged
(
HOGLAKE_REFUSE_COLLIDING_NAMESoff, Rollout step 3). Case-only pairs of one kind are the one case the resolution rule below has to handle. A table and a view that share a name each stay addressable through their own routes. Both kinds of pair have to be gone before the last rollout step. - An exact duplicate of the same kind is refused whatever the flag says, as it always was. Everything the fold adds is staged: a fold-equal sibling of the same kind, and a table and a view with fold-equal names, the same spelling included, since no check between the two kinds existed before.
Every lookup by name, at head or at a snapshot, runs one rule:
- Read the visible siblings fold-equal to the requested name, the one spelled exactly as requested first, and stop after two.
- No row: not found, as today.
- One row: that is the object.
- Two rows, the first spelled exactly as requested: the first.
- Two rows, neither exact: refuse as ambiguous.
Step 4 keeps a legacy pair addressable by clients that spell names exactly (pyhoglake, the console, DuckDB). Step 5 is all Trino can get for such a pair, and it is what truffle's DuckLake connector answers.
A destructive request through another spelling reaches the same object:
DELETE .../tables/events drops Events. That is what every SQL engine
in the table above does. expected_table_uuid remains the guard against
acting on the wrong incarnation.
A column path resolves one segment at a time by the same rule
(AlterService.requireColumn): payload.UserId finds Payload.userid.
A commit resolves its namespace first and then the table among that
namespace's tables. One table named in two spellings in one commit is
one table: its entries merge by the resolved id, as two entries in one
spelling always did.
Atomic table creation treats its target two ways. A plain creation
through /table-creations is taking the name, so only the exact
spelling is an existing target (rejected/target_exists).
A fold-equal table or view is the creation's own collision, staged like
POST .../tables, and the creation never answers ambiguous_name. A
replacement names what the caller read, so its target resolves by fold
at prepare and again at publish, and it stores the spelling it was
asked for: replacing Events as events retires Events and creates
events. Through truffle, which sends lowercase names, a CREATE OR REPLACE therefore lowercases the table's name. A replacement is staged
like any creation against the relations fold-equal to its name other
than its target: the other member of a legacy pair, or a fold-equal
view. With the flag off it commits and is counted; with it on the
receipt is a durable rejected/target_exists, and nothing is applied:
the target keeps its table uuid. A namespace or a target
that has become ambiguous since prepare is a durable rejected, with
namespace_changed or target_changed.
-
Bodies carry the stored name. A
GET .../tables/eventsfor a table stored asEventsanswers"name": "Events". Lakekeeper echoes the requested spelling instead; hoglake cannot, because clients build object paths from the names in the response. -
Three answers carry the name of the path instead, because the object is reached there under a name of hoglake's own:
- a served namespace (
team_<id>) answers with the served name innameand in its tables'namespace, not the source namespace's spelling, since the served path is matched exactly (below); - a stream table answers with the served namespace and the
published table name (
ServedNamespaces,.copy(namespace = ...)); - a remote schema answers with the mount's local alias in
namespace(NamespaceFieldRewrite).
Each is the spelling the next request on that path must use.
- a served namespace (
-
Paths are spelled with the stored name.
data/<namespace>/<table>/and<field>=<value>/are compared as bytes. A client that builds them from its own spelling writes to the wrong prefix. Where the prefix is enforced, on an object-prefix table or in a contained namespace, the server refuses that commit: it checks paths against the stored names, whatever the request spelled (The commit path). -
Labels and dedupe keys use resolved ids or stored names. Once a lookup resolves any spelling, a metric labelled with the requested name gets one series per spelling a client cares to send. The blind-append WARN already dedupes on
tableIdrather than on a client-supplied name (AGENT.md, invariant 12), andhoglake_blind_partitioned_appends_total{catalog,namespace,table}and that WARN now name the table as stored, on both stores. So do the commit path's refusals and their typed fields (ddl_since_read_snapshot'stables,table_recreated'stable, the dropped-table refusal), on both stores (Hoglite). -
A refusal for a name that resolved to nothing echoes the request. There is no stored spelling to quote: a missing table is
table '<namespace as asked>.<table as asked>' in catalog '<catalog>' at snapshot N, and a commit'sunknown tablenames the table as asked. One exception: for a scoped caller, a missing table's 404 names its namespace by the stored spelling, because the operation acts on the namespace its authorization resolved (Authorization). A caller that is not scoped sees the spelling it asked for. -
Listings list stored names, both members of a legacy pair included.
-
A replay keys on the request as sent. An idempotent commit replayed in another spelling is a different payload: 422
idempotency_key reused with a different request.
- The
_hogcolumn prefix is matched after folding, so_HOG_ROW_IDis refused once the flag is on, and counted under kindreserved_columnuntil then;_hog_row_idas written is refused whatever the flag says. Before this changeIdentifiers.validateColumnused a case-sensitivestartsWith, and a file holding both_HOG_ROW_IDand compaction's_hog_row_idwould meet the connector's case-collision refusal. That consequence is read from the two sources, not reproduced. - Reserved namespace names and the
team_<digits>shape already fold ASCII. They move toIdentifiers.foldand do not change behaviour.
- A registration carries no column names. A
FileRegistrationis a path, counts, sizes, partition values and stats keyed byfield_id, and the server never opens the file at commit. The only names in a commit are itsnamespaceandtable, which resolve like any other lookup. - Files with field ids bind by id. The case of a footer name
decides nothing, on the server, in truffle or in the DuckDB
extension. This covers truffle
INSERT, pyhoglake, millrace, hedgerow and compaction outputs. - Files without field ids bind by fold-equal name, on the server and
in truffle. truffle binds by id, then by exact name, then ignoring
case (
HoglakeParquetFields.bind). Before this change the server bound an id-less field by exact name only, so the two disagreed about the same file. The server's binder (FooterStats.Binder, which the hydrator andParquetRewritershare) now runs in two phases under each parent. First every column binds by field id, then by exact name, and the fields bound this way are taken. Then each column still unbound binds the one untaken id-less field whose name is fold-equal to its own. Ambiguity is counted only among the untaken fields and the columns still unbound, so a case twin bound by id or by its exact field neither competes for the other twin's single candidate nor makes it ambiguous. - An ambiguous fold match binds nothing. Two id-less file siblings
fold-equal to one column, or two columns still unbound fold-equal to
one file field: the hydrator records no stats for the column, and
compaction refuses the input. It never null-fills a column it could
not bind for this reason. A column still unbound whose name matches
an untaken id-less field only under truffle's Unicode case mapping
(The fold) is ambiguous too: the hydrator records no
stats for it, and compaction refuses the input rather than null-fill
values Trino reads. The refused group is
counted as
unconvertible_schema: like that counter's other cases it clears when the schema or the file set changes. - An exact spelling is never a fold candidate. A file field spelled
exactly like one column belongs to that column. With legacy columns
useridandUserIdand a file that holds onlyUserId,useridis absent from the file, not ambiguous. truffle differs for such legacy shapes, as read from its source and not run: it refuses a file with two fold-equal fields and binds the first match for two fold-equal columns. - The DuckDB extension binds id-less fields by the same rule
(#766, fixing #761): by id, then by exact name, then by
the one fold-equal id-less field; two candidates refuse the file. It
binds an id-less field only when the field's type is the column's or
a lossless widening of it, and refuses the file otherwise. Two id-less
fields spelled identically (Parquet allows it) refuse the file there
too, and the server agrees: the hydrator records no stats for a file
whose schema names two siblings the same (
FooterStats,duplicateSiblingNames), and compaction refuses it (ParquetRewriter.refuseDuplicateNames). Before #766 the extension read every column of such a file as NULL, with no error, because its table columns carry field-id identifiers and DuckDB's by-name mapping matched none of them. - Fold binding widens the dropped-name hazard to every spelling of
the name. Over an id-less field
UserId, dropping columnUserIdand addinguseridmakes compaction copy the old values intouserid, as an exact re-add always did. Theidless_files_presentguard covers this only once the hydrator has flagged the file. - Writers match their input to columns by exact name, as now:
pyhoglake's Arrow columns (
_align_table), millrace's payload keys (doc.get(column.name)), hedgerow's projection. A payload key is data:UserIdsent to columnuseridis an unknown key, not a match. pyhoglake's side was decided in open question 3: exact, with a refusal that names the fold-equal column.
The disagreement over id-less files is reachable today, without any of
this design. PostHog's Trino import path
(hoglake_register_data_imports.py in PostHog/posthog) creates the
table through Trino, which lowercases its columns, and registers the
source's files with add_files. A source column UserId becomes
catalog column userid over a footer that says UserId. If the file
carries no field ids, truffle reads the column, the hydrator records no
stats for it, and compaction writes it as nulls: an unmatched top-level
column is null-filled (ParquetRewriter.planChildren and its KDoc).
This was read from the three sources, and then reproduced on the
compose stack before the fix: the server wrote userid as nulls for
every row and retired the inputs that held its values. PostHog's REST
import writer (gigahog_register_data_imports.py) keeps the source's
spelling in the catalog, refuses a file that carries field ids and
refuses columns that differ only by case, so its files bind exactly on
both readers.
The rule is about catalog names. A data file can still carry two sibling columns that differ only by case: one written by a foreign writer, or one written under a table that already held such a pair.
- The catalog cannot see it. Registration never opens the Parquet, so nothing here is a server check.
- truffle cannot read such a file, whatever the catalog says: its
reader lowercases footer names before it binds. The connector refuses
the read, and its
add_filesprocedure runs the same refusal before it registers a file. - Importers fail by default. A writer that meets colliding source fields refuses the batch. Renaming one with a suffix, or moving both into a VARIANT column, is a choice the writer's operator makes. The catalog never renames a column on a writer's behalf.
- Unique catalog names keep the id-less fallback unambiguous. With the catalog's names unique after folding, binding by fold-equal name (above) names at most one catalog column per file column.
| Request | Answer |
|---|---|
| Create a namespace, table or view, or rename a table, to a name fold-equal to another live sibling, a table and a view being siblings | 409 already_exists, naming the kind and stored spelling of what holds the name: the exact spelling first, then the first by bytes |
| The same through an atomic table creation, at publish | Receipt rejected/target_exists; the receipt and the log do not name the relation |
| Add or rename a column to a name fold-equal to another sibling | 422 validation, as an exact duplicate answers |
| Create a table whose definition holds two fold-equal sibling columns | 422 validation |
A column name starting with _hog in any case |
422 validation |
| A lookup with two candidates and neither exact | 422 ambiguous_name, naming the two it read |
| The same lookup by a scoped caller, for a namespace on a namespace-gated route, in a write body or on an upload claim, or by a served or stream reader | 404, with the status and body a missing namespace or table gets. That is what this guarantees; comparing answers across spellings can still reveal a fold-equal twin (Authorization) |
A scoped upload claim under data/<segment>/ whose segment is another spelling of the caller's namespace |
403: a prefix is bytes, and the claim is under no namespace's prefix |
ambiguous_name is a new typed HoglakeException. The rows about
fold-equal names and _hog are new refusals on paths deployed writers
use, so they are staged (Rollout): until
HOGLAKE_REFUSE_COLLIDING_NAMES is on, those requests are accepted and
counted.
Three partial expression indexes serve both the lookup and the
collision check. V38 builds them (CREATE INDEX IF NOT EXISTS, inside
the migration's 5 s lock_timeout window). A DO block first drops an
index of the same name that is INVALID, as a failed concurrent hand
build leaves one, or that is built over another expression, because
IF NOT EXISTS matches on the name alone and would otherwise leave
every folded lookup filtered:
CREATE INDEX hog_namespace_live_name_folded
ON hog_namespace (catalog_id, lower(name COLLATE "C"))
WHERE NOT dropped;
CREATE INDEX hog_table_version_live_name_folded
ON hog_table_version (catalog_id, namespace_id, lower(name COLLATE "C"))
WHERE end_snapshot IS NULL;
CREATE INDEX hog_view_live_name_folded
ON hog_view (catalog_id, namespace_id, lower(name COLLATE "C"))
WHERE end_snapshot IS NULL;-
COLLATE "C"is required. In a database created with the ICU localetr-TR,lower('TEAM_I')returnsteam_ı, andlower('TEAM_I' COLLATE "C")returnsteam_i. Under"C"the Kelvin sign andİcome back unchanged. -
The lookup needs the index. Measured on PostgreSQL 18.7 with
server/schema.sql, one namespace of 54,000 live tables and 54,000 ended version rows, warm:Lookup of one table by name Plan Shared buffers Exact, as today hog_table_version_live_name3 Folded, no new index Seq Scan, 108,003 rows filtered 1,495 Folded, with the index hog_table_version_live_name_folded, 1 search, nothing filtered7 Folded, generic plan with a bound parameter The same 7 The table GET is on the writer fleet's flush path and the commit read resolves names under the commit lock, so a scan per lookup is not an option. This fixture was the design-time check. The plan tests are
V38FoldedNameIndexMigrationIntegrationTest, which EXPLAINs the repos' own lookups before and after V38 on a fixture past the 100,000-row floor, andCommitNameResolutionPlanIntegrationTest, the commit read on 132,002 version rows: one index search per probe, nothing filtered, 3 and 4 buffers per probe, custom and generic plans alike. -
Reads at a snapshot do not get slower.
TableRepo.findAthas no index on a name at a snapshot today: the same fixture reads 1,492 buffers for an exact name. Folding changes its filter, not its plan. -
The indexes start out not unique. A unique build fails on the first legacy pair, and a migration that fails leaves every pod unable to boot. Until the audit is empty, uniqueness is enforced where exact uniqueness of columns already is, in the service, and DDL already takes the per-catalog commit lock before its exists check (
createNamespace,createTable,createView). Unique indexes are the end state, as the last rollout step. They must stay partial:hog_table_versionkeeps ended rows, and a comment change ends the live row and inserts a new one with the same name. A case-only rename in the service's write order (end the live row, insert the new one) passes a unique folded index; checked. -
The partial predicate is enough for a drop.
end_snapshot IS NULLdoes not mentionhog_table.dropped_snapshot, and does not need to:markDroppedends the live version row in the same transaction, andhog_table_version_live_name, the unique index on the exact name, already has this predicate. DroppingEventswithmarkDropped's statements and then creatingeventspasses a unique folded index; checked. The audit has a query for live version rows on dropped tables, which must be empty before the unique build. -
Tables against views is a service check, permanently. No index spans two tables.
RelationNames.requireFree, called bycreateTable, a table rename andcreateView, reads bothhog_table_version_live_name_foldedandhog_view_live_name_foldedunder the commit lock those paths already hold, excluding the table being renamed or replaced by id. No index will ever fail on a legacy pair of this kind, so the last rollout step waits for that audit to be empty too. -
Cost. 4.1 MB for the 54,003 live names of the fixture, built in 58 ms on an idle scratch database.
hog_table_versionrows are written by DDL, not by commits, so the commit path writes none of these indexes. The migration follows the lock-window rules in AGENT.md and states its own measurement; a plain build onhog_table_versionwaits for an expiry sweep's row lock like any other. -
Columns need no index. A table's live columns are loaded whole and resolved in Kotlin (
AlterService.requireColumn); the comparison changes from==to fold-equal.
One resolver per kind replaces the name predicates. The repo functions
(NamespaceRepo.findLiveByName and findAt, TableRepo.findLive and
findAt, ViewRepo.findLiveByName) read through the folded predicate
with ORDER BY (name = :name) DESC, name COLLATE "C" LIMIT 2 and
apply the resolution rule in Kotlin
(NameResolution). That form uses the folded index and returns the
exact member of a seeded pair first, then the first by bytes, which is
also the one a collision refusal names; checked on the fixture above.
The other places that compare a name directly go through the resolver
or use the same predicate: CommitTail.READ_SQL,
two reads in CommitService, MountReadService,
PartitionStatsService's filters, ServedNamespaces, and
CatalogService.requireNeverHeld. A grep finds about fifteen such
statements outside the Hoglite store.
-
The comparison is
COLLATE NOCASE, which SQLite defines as folding the 26 ASCII capitals and nothing else.lower()is avoided because SQLite's ICU extension replaces it with a Unicode one. -
Uniqueness is a transaction guard, in the store's existing
expectZerostyle: zero live siblings equal underNOCASEother than the object itself. For a table or a view the guard reads bothtablesandviews. hoglite serializes a tenant's transactions, which is what the commit lock gives PostgreSQL. -
Four
NOCASEindexes for new tenants, from the start.NOCASEcannot use theBINARYname indexes (tables_live,views_live,namespaces_live,table_versions_name) for the name, so without one a lookup scans.HogliteSchema.NAME_NOCASE_INDEXESholdsnamespaces(name COLLATE NOCASE),tables(namespace, name COLLATE NOCASE)andviews(namespace, name COLLATE NOCASE), eachWHERE dropped_snapshot IS NULL, andtable_versions_name_nocase ON table_versions(namespace_id, name COLLATE NOCASE, end_snapshot), which is not partial because time travel reads ended versions. None is unique, for the reason the PostgreSQL ones start out not unique. A head read finds the table throughtables' head name (tables_live_name_nocase); a read at a snapshot searchestable_versions_name_nocase. The bootstrap alone lays them down. Tenants have no migrations (HogliteSchemaKDoc), and this change carries no tenant upgrade, so a tenant that already exists gives the same answers and, until one adds the indexes, scans its namespace's live tables at head and its namespace's version history at a snapshot. That upgrade is the fourCREATE INDEX IF NOT EXISTSstatements alone; no table is rebuilt. -
The scan is bounded by one namespace's live tables, as long as the store resolves the namespace to its stored name first and then compares
namespaceexactly. Measured on in-process SQLite 3.46.1 with the tenant'stablescolumns and itstables_liveindex, not on hoglited:Live tables in the namespace Exact, as today NOCASE, no new indexNOCASE, with the index20 2 µs 6 µs 5 µs 1,000 2 µs 109 µs 5 µs 5,000 2 µs 510 µs 5 µs 50,000 3 µs 5,010 µs 5 µs The scan reads the partial index, so dropped tables cost nothing. Folding the namespace in the same predicate loses the bound: 50,000 live tables over 500 namespaces took 3,527 µs that way and 15 µs with the namespace resolved first. One statement that probes the exact name and falls back to the scan does not help: SQLite ran the scan anyway, 736 µs on an exact hit among 50,000.
Measured again on a live hoglited at implementation, one table lookup in one namespace, 200 runs after 20 warm-ups, p50 / p95 in µs. Each figure includes the round trip to hoglited, which is why the small cases are dominated by it and do not order cleanly:
Live tables in the namespace Exact Fold, with the index Fold, without the index 20 1,493 / 2,323 1,568 / 2,553 992 / 1,237 1,000 963 / 1,821 969 / 1,243 1,151 / 1,928 5,000 705 / 880 837 / 1,095 1,625 / 2,085 50,000 621 / 823 679 / 864 10,861 / 18,541 Measured once more after head reads moved to
tables' head name and the version index was added: hoglited build-588542c8, one namespace of 40,001 tables with one version each, 40 calls after 5 warm-ups, mean µs per call including the round trip:Call New tenant Tenant without the indexes Round trip ( SELECT 1)1,632 1,023 Table lookup at a snapshot 1,801 9,054 Table lookup by head name 1,740 8,598 planScan at head 7,512 14,131 planScan at a snapshot 6,141 12,231 Not measured: a tenant with deep version history, where the lookup at a snapshot without the index reads every version of the namespace.
The largest tenant's live-table count is still not known (open question 5).
-
About forty statements compare a name across
HogliteCatalogStore,HogliteCommit,HogliteTableCreations,HogliteAlters,HogliteViews,HoglitePartitions,HoglitePartitionLookupandHogliteCompaction. A grep count, not an audit. Resolving the namespace and table to ids once and passing ids down is the smaller change. -
Same status, code and body on both backends, in one test class parameterized over them (AGENT.md, Hoglite considerations). Hoglite's refusals name the namespace and table as stored, in PostgreSQL's words: a namespace drop's refusals, clearing a non-empty namespace's containment, drop and truncate's
table_recreated, the alter's refusals, the partitionkey_index422 and the changefeed'sreconciliation_required. -
A commit's names resolve at plan, not under a lock. Hoglite resolves a commit's table names when it plans, and the write transaction guards the resolved table by id, not by name. So while
HOGLAKE_REFUSE_COLLIDING_NAMESis off, a commit toeventsthat planned while onlyEventswas live registers its files toEventseven ifeventsis created before the commit is written. PostgreSQL resolves under the commit lock and would register them toevents. With the flag on the second table cannot be created, so the difference does not arise. This is documented, not guarded.
-
Authorize the resolved object, never the spelling. The namespace gate reads a namespace's containment by name (
NamespaceGate), soTEAM_5is authorized asteam_5is, on the mark that namespace carries. For a scoped caller every operation then acts on the namespace its authorization resolved: hoglake hands the store that namespace's stored name, and a read at a snapshot or timestamp answers as a missing namespace unless the name resolves at that pin to the same namespace, by id (CatalogStore.namespaceIdAt). A partition-lookup continuation is checked at its cursor's pin when the request carries nosnapshot: the cursor is unsigned and carries its own snapshot, so the caller chooses that pin, and a check without it answered 400cursor does not match lookupwhere a first request answered the missing-table 404, which told the caller whether a case twin of its namespace held the table. A served namespace reads its source namespace the same way. The cost is one more namespace lookup for a scoped caller's pinned read and for a served import read.Two residuals remain. The commit request is not rewritten, because its body is the receipt's fingerprint, so a scoped commit that spells its namespace otherwise than stored resolves that spelling again at commit. While the flag is off, someone could create, between the authorization and the commit, a twin namespace spelled exactly as the request and a table of the same name in it, and the commit would resolve to that table. Its files are still held to containment: on both stores the commit reads the containment of every path's first segment as well as of its target namespaces (
CommitService.containmentNames, andHogliteCommit's), andContainment.violationrefuses a path whose segment is a contained namespace other than the commit's own ("belongs to contained namespace"). So a file under the caller's own contained prefix is refused for a table in the twin, and only a file outside every contained prefix could be registered there. And a futureat_timestampis resolved twice, by the check and by the read, so the two can differ by one snapshot. -
The reused-name refusal must fold.
requireNeverHeldrefuses to mark a namespace contained when another namespace has ever had its name, because a read at a past snapshot resolves the namespace by name and "a dropped namespace that once had this name would be served to whoever may read this one". With folded resolution, a droppedTeam_5that held tables is such a namespace for a liveteam_5. The check compares folds, or a scoped caller's time-travel read crosses into it. Its refusal reads "namespace name '' is held by another live namespace or has belonged to another, dropped namespace in this catalog; only a name no other namespace has had can be marked contained". The stores differ here, a known gap: Hoglite refuses for any other namespace with a fold-equal name, PostgreSQL only for one that has held a table or view. -
Ambiguity is a 404 to a scoped caller: on a namespace-gated route, in a write that names its namespaces in the body, and on an upload claim (
StoreGrant,scopedLookup), refused as a missing namespace is and counted once in the auth refusal series asnot_entitled. A caller that is not scoped gets the 422ambiguous_name, the read-only operator included.What this guarantees is the status and the body: an ambiguous namespace answers exactly as a missing one. It does not hide that a twin exists. With
team_5the caller's own and another team'sTEAM_5live,Team_5answers 404 where it answered 200 before the twin existed, andTEAM_5answers 404 whileteam_5answers 200, so comparing answers across spellings reveals the twin and its spelling. This follows from the resolution rule; the remedy is the uniqueness rule, which stops such twins being made once the flag is on. -
Path prefixes stay literal. Containment compares prefixes as bytes, and
data/Team_5/anddata/team_5/are different prefixes on S3, whose keys are case-sensitive. A scoped upload claim underdata/<segment>/is admitted only when<segment>is the stored name of the namespace it resolves to, byte for byte (CatalogStore.liveContainedNamespace); another spelling of the caller's own namespace is 403. -
Served namespaces: the source lookup folds, the path does not. The served path is matched exactly: only the canonical lowercase
team_<id>is served (CatalogStoreSelector.servedBindingthroughTeamNamespaces.id, whose pattern is case-sensitive), soTEAM_5is not a served path. Behind it,ServedNamespacesreads the source namespace the caller rule proved the team on (ProvenTeam.source), by its stored name, and checks its id at a pin (CatalogStore.namespaceIdAt); a published stream table name matches the request by fold, andMountReadServicefinds the stream table throughTableRepo.findAt. Their readers are scoped, so ambiguity is a missing table or namespace to them. A served namespace's answers carry the served (canonical) name innameandnamespace, as the stream half does, never the source's stored spelling. A served namespace is read-only: every write answers 403read_only_catalog, so a client never builds object paths for one. This half is PostgreSQL only. -
A remote schema's alias rewrite compares by fold. The mount host resolves the schema's name by fold and answers its stored spelling, and
NamespaceFieldRewriteaccepts any fold-equal answer and replaces it with the alias. During a rolling deploy, an old replica gets 502mount_host_invalid_responsefrom an upgraded host when the mount's name for the schema differs from the host's stored spelling only by case; before the host upgraded, that mount got a 404. -
Hoglite read sessions depend on hoglited. A read session's scoped reads (namespace, table, scan) are resolved by hoglited, outside this repository, which matches names exactly today (
COLLATE BINARY), so another spelling there is the missing-name 404 while the store path resolves it. hoglake accepts a fold-equal answer and carries the owner's stored spelling (HogliteScopedNamespaceRead), so the path resolves case once hoglited's scoped queries fold.
Before this change CommitTail.READ_SQL joined each requested
(namespace, name) to its live table with tv.name = q.name AND ns.name = q.namespace LIMIT 2. It now resolves each requested
namespace among its live fold-equal siblings and then the table among
that namespace's, exact spelling first and at most two each, through
V38's indexes, and CommitService applies NameResolution to both
(the plan test is CommitNameResolutionPlanIntegrationTest, above).
The path checks moved to the stored names in the same change.
Before it, CommitService built each ResolvedAppend from the
request's spelling, and checkObjectPrefix and checkContainment
compared the registered paths with prefixes built from it. Once
events resolves to Events, that code would accept files under
data/<ns>/events/ for a table whose root is data/<ns>/Events/. Both
checks, the contained map they read and the names in their refusals
take the stored spelling from the commit read, and HogliteCommit's
counterparts do the same. An atomic creation's initial files are held
to the stored names too, whatever the definition spelled.
A client that builds paths from its own spelling is then refused with
the existing object-prefix or containment error, and nothing is
registered under another prefix. A table with neither an object-prefix
layout nor a contained namespace has no enforced prefix: its files are
found by their registered paths, wherever under data_path they sit.
Two more rules fall out of keying on the resolved id:
- The conflict check reads candidates and keeps resolved tables.
The commit read's conflict rows cover every fold-equal table a key
read, not only the one it resolved to. A DDL row counts for any table
the request resolved to. A row-content row counts only for a table
that a guarded delete target, or a table an
all_filesreplacement ends, resolved to. Over a legacy paireventsandEvents, a guarded delete oneventsbeside an append toEventsin one commit is not refused for an append that raced intoEvents. ambiguous_nameis a validation failure in the commit metrics.hoglake_commits_totalcounts a commit refused asambiguous_nameunderresult="validation", as it countsunknown table; that series covers PostgreSQL commits only (Hoglite commits are not in it, #677). The audit record saysambiguous_name.
- OpenAPI. The name schemas keep their pattern and gain the rule:
compared after folding ASCII case, returned as stored. The
nameandnamespacefields of a response are documented as the stored spelling. - A capability,
case-insensitive-names-v1, in the catalog'scapabilities, so a client can tell a server that resolves case from one that does not. It is advertised for every catalog, and three places still match exactly: a Hoglite read session's scoped reads (hoglited), the servedteam_<id>path, and a remote schema whose host runs a build without the rule. - A new error code,
ambiguous_name. - A shared vector file,
pyhoglake/tests/vectors/identifier_case_vectors.json, in the style of the bounds and shredding vectors: names, their folds, fold-equal and not-equal pairs, and resolution outcomes, 87 vectors with the count pinned on both sides (test_identifier_case_vectors.py,IdentifierCaseVectorsTest).
| Consumer | Before | Change |
|---|---|---|
truffle (trino-hoglake) |
Sends Trino's lowercased names; builds write paths from them; exposes no hoglake views (HoglakeMetadata has no view methods) |
Build write paths, and the names in commits, from the namespace and name of the table response: PostHog/truffle#245, which ships before the server resolves case (Rollout). checkNoCaseCollision stays for legacy files. One read follow-up: the shared connector hides namespaces that are not lowercase from SHOW SCHEMAS (HoglakeSharedConnector.listSchemaNames), so after step 3 such a namespace is queryable but not listed; listing it is gated on case-insensitive-names-v1 |
| Server: hydrator and compaction | Bind a file field without an id by exact name only (FooterStats.bindIndex) |
Id and exact name first, then the one untaken fold-equal id-less sibling (FooterStats.Binder); an ambiguous match, or one only truffle's Unicode case mapping makes, binds nothing (Ingestion) |
Trino harness (server/trino/) |
No mixed-case case | A namespace, table and column created in mixed case through the REST API, read through Trino in lowercase. A file without field ids whose column is spelled in another case, read before and after compaction. Both are in HoglakeTrinoIntegrationTest (mixedCaseNamesAreReadThroughTrinoInLowercase, idlessColumnSpelledInAnotherCaseReadsTheSameAfterCompaction) |
| pyhoglake | Exact names. Catalog.namespace() keeps the caller's spelling on its fallback path; table paths come from TableInfo |
Takes namespace, table and view names from responses, and builds URLs, commit names and object paths from them; 422 ambiguous_name is AmbiguousNameError. Ships with the server at step 3: its fallback would otherwise build paths from the caller's spelling. Arrow columns keep matching exactly, and the refusal names a column that differs only by case (open question 3) |
| duckdb-client | Resolves through listings; conflict-checks DDL itself | Has truffle's hazard: for a namespace its listing does not show, it builds the write path from the name the user typed (HoglakeTransaction::GetSchema's probe). The fix is #762, which, like truffle's, ships before step 3 reaches a server the extension writes to. It binds a file without field ids by the server's rule from #766 on, which fixes #761 (Ingestion). One gap remains: CREATE SCHEMA checks only the listing, not the server, for a fold-equal namespace. With the capability it may later drop the listing round trip, and it still takes the namespace's and table's spelling from the server's answer (#762 makes that a rule in duckdb-client/DESIGN.md) |
| hedgerow | Matches source and destination columns by exact name | None |
| millrace | Looks configured columns up by exact name | None |
| webui | Routes by names from listings | None required |
| PostHog import writers (PostHog/posthog) | The REST writer keeps the source's column spelling and refuses case-only pairs; the Trino path creates lowercased columns over footers in the source's spelling | None. The Trino path's files depend on the server's fold binding |
| Iceberg facade (not built) | Resolve REST namespace, table and view identifiers with the same resolver; export stored names. Trino's Iceberg connector then needs no case-insensitive-name-matching. A view named like a table answers AlreadyExists, as Iceberg's own catalogs do |
The repository's rule for a new refusal on a deployed writer's path is a flag that defaults off, a counter, and a flip when the counter is quiet (AGENT.md, Scale doctrine).
-
Audit. Run the queries in each environment. Four numbers matter: case-only pairs, tables and views that share a name, live version rows on dropped tables, and live names that are not already lowercase. The last is what truffle cannot address today.
-
Fix what is wrong today. Changes that need no flag and do not wait for the rest:
- truffle builds write paths, and the names in its commits, from
the table response. While the server still matches exactly, the
response's names are the names truffle sent, so this changes
nothing yet. It has to be in every cluster that writes before the
next step, or the first
INSERTinto a table truffle could not address before goes todata/<ns>/events/for a table stored asEvents. PostHog/truffle#245. - The DuckDB extension builds the write path of a namespace its listing does not show from the server's answer, not from the name the user typed. #762; it has to be in every extension build that writes to a server before step 3 reaches it, for the same reason.
- The server binds files without field ids by fold-equal name (Ingestion), which closes the disagreement with truffle that exists today. #763.
- truffle builds write paths, and the names in its commits, from
the table response. While the server still matches exactly, the
response's names are the names truffle sent, so this changes
nothing yet. It has to be in every cluster that writes before the
next step, or the first
-
Resolve and count. Ship the fold, the indexes, the resolver on both backends,
ambiguous_name, the capability, and the commit path's checks against stored names. The last is the server's own guard for the step before: a truffle that still builds paths from lowercased names is refused on an object-prefix table or in a contained namespace, and registers nothing under the wrong prefix. A request that would create a case-only pair, or a table and a view sharing a name, is still accepted, logged at WARN once per catalog, kind and parent per pod (the parent named by its kind,catalog,namespaceortable, and its id, because table and namespace ids overlap), and counted inhoglake_colliding_names_total{catalog,kind}.HOGLAKE_REFUSE_COLLIDING_NAMESdefaults tofalse. pyhoglake's change ships in the same release: its fallback would otherwise build paths from the caller's spelling.The counter counts ATTEMPTS, not names. A request that rolls back and is retried counts again; an atomic creation counts its column collisions at prepare and again at publish; one request can count under two kinds (a table fold-equal to both a table and a view is a
tableand atable_view). And a guarded replacement whose target has a fold-equal twin counts on every replacement, so a legacy pair that is still being replaced keeps the counter above zero until one of the pair is renamed or dropped.While replicas of both builds serve, atomic table creation can cross them. A creation prepared on a replica that resolves names by fold, whose request spelled its namespace or replacement target in another case, is rejected durably (
namespace_changedortarget_changed) if a replica without fold resolution publishes it, because that replica looks names up exactly. Nothing is written, the target stays live, and the client prepares again. The other direction is safe: an older replica refuses any other spelling at prepare, so a creation it prepared names its target exactly and a newer replica publishes it unchanged. -
Refuse. Set the flag per environment once the counter has stayed at zero and every replica that takes writes runs a build with the check. An older build does not read the flag and still accepts a colliding name: on the compose stack it answered 201 to a table that a replica with the flag on had just refused with 409. Then make
truethe default in a later release. From here the uniqueness rule holds for everything new. -
Other clients. The DuckDB extension may drop its listing round trip; it still builds paths from the spelling the server answers (#762). (pyhoglake was planned here and moved to step 3.)
-
Enforce in the database. Once the flag is on and three audits are empty in every environment (case-only pairs, tables and views that share a name, live version rows on dropped tables), a later migration replaces the three folded indexes with unique ones. A pair found before then is renamed by its owner first. The table-against-view check stays in the service, because no index spans two tables. It is in the gate all the same: nothing else would ever make an owner rename such a pair, and the first reader with one relation namespace, truffle once it exposes hoglake views or the Iceberg facade, could not serve it.
Step 3 changes one thing a client could notice besides the count: a
request that answered 404 for events now finds Events. A client
that creates on 404 stops creating case twins, which is the point.
What the tree holds, by concern. Classes named Hoglite* under
com.posthog.hoglake.hoglite run on both backends where they take a
Backend parameter, and run in hoglite-live (just test-hoglite).
- The fold, cross-language. The shared vector file
(
IdentifierCaseVectorsTestand pyhoglake'stest_identifier_case_vectors.py, both pinning 87 vectors), plus a property thatIdentifiers.foldequals Java'stoLowerCase(ENGLISH)on valid identifiers and differs from Kotlin'slowercase()on the Kelvin sign.IdentifiersFuzzTestchecks on every fuzz input that the fold is an ASCII-only lowercase, thatfoldEqualsis symmetric and equals equality of the folds, thatvalidateColumnrefuses exactly the pattern's refusals and names whose fold starts_hog, and thatNameResolution.amongresolves exact, then single, then ambiguous, each against a reference written apart from the code. NOT BUILT: the property against PostgreSQL'slower(x COLLATE "C")and SQLite'sNOCASE. Both stores are exercised through the lookups below, not by a property over the identifier pattern. - Parity.
HogliteNameCaseParityIntegrationTest, over both backends: lookup at head and at a snapshot, case-only renames, drops through another spelling, the flag on and off for every kind, a table against a view in both orders in the same spelling and another case, exact duplicates, atomic table creation's outcomes, a commit to one member of a legacy pair checked against that member's object-prefix layout, and Hoglite's refusals naming the stored names in PostgreSQL's words.HogliteExtendedGuardRaceIntegrationTestpins that, with the flag on, a twin table, view or namespace created inside a create's window still refuses it inside the transaction. The PostgreSQL-onlyNameCaseIntegrationTestand the Hoglite-onlyHogliteIdentifierCaseIntegrationTestcover the service layer of each store. There is no namespace or view rename in the API, so "rename" means tables and columns. - Legacy pairs. Made both ways. Through the API with the flag off,
which is how a deployment gets them (
NameCaseIntegrationTest,HogliteIdentifierCaseIntegrationTest,HogliteScopedNameCaseParityIntegrationTest), and by SQL, a row renamed in place, where a test must not depend on the flag-off create (HogliteNameCaseParityIntegrationTest,CommitIdentifierCaseIntegrationTest). They assert: exact wins, a fold-only lookup isambiguous_namenaming both, listings show both, and a refusal against the group names the exact spelling first, then by bytes. - Id-less binding.
ParquetRewriterTestandFooterStatsTest(another case binds, exact outranks fold, an ambiguous fold match refuses the input and records no stats, the fold is ASCII only, an id-bearing field never binds by name, a twin bound by id or by its exact field leaves the one fold candidate to the other twin, and a Kelvin sign, long s or dotless i that only Trino maps binds nothing and refuses the input), andHogliteIdlessBindingIntegrationTestand the PostgreSQLIdlessBindingIntegrationTest(hydrated and compacted end to end). The Trino harness reads the same values before and after compaction (idlessColumnSpelledInAnotherCaseReadsTheSameAfterCompaction). TheNestedAgreementfuzz target gained id-less fields in varied case, the Trino import shape, decoys in the Kelvin sign, long s and dotless i, and fields inside a list's element and a map's value; its pinned seeds are deterministic tests inNestedCampaignRegressionTest. - Paths. On both backends, a commit that names an object-prefix
table, or a table in a contained namespace, in another spelling: with
paths under the stored spelling it is accepted, with paths under the
request's spelling it is refused (
CommitIdentifierCaseIntegrationTestand the parity class). - The commit path.
CommitIdentifierCaseIntegrationTest: one table named in two spellings, typed refusals and metric labels in stored names, a receipt replaying only in its own spelling, an atomic creation's initial files held to the stored namespace. - Authorization.
HogliteScopedNameCaseParityIntegrationTest: a scoped caller reaches its namespace through another spelling and never another team's, a legacy pair is a missing namespace to a scoped caller andambiguous_nameto anyone else, and an upload claim must spell the stored name; and an operation, a pinned read included, acts on the namespace the grant authorized, never on a fold-equal twin.ServedNamespacesIntegrationTest: a source namespace stored in another case is served under the served name, at head and pinned, and a pinned served read never reads a twin.CollidingNamesWarnKeyTest: a table and a namespace with the same id are two WARN parents. The reused-name refusal on a fold-equal dropped namespace is inNameCaseIntegrationTestand the parity class. - The plan.
V38FoldedNameIndexMigrationIntegrationTest(which also replaces an INVALID or differently built index of V38's name) andCommitNameResolutionPlanIntegrationTest(132,002 version rows; 3 and 4 buffers per probe). On Hoglite,HogliteIdentifierCaseIntegrationTestrunsEXPLAIN QUERY PLANthrough hoglited for the table lookup at a snapshot, andHogliteSchemaTestpins thattable_versionshas the non-partial folded index. - Mutation. Done on the branch, per AGENT.md; the tree records the tests, not the flips.
- Fuzzing. The wire corpus gained case variants
(
case_creation_colliding_columns,case_alter_rename,case_commit_append) and the identifier target gained eight (case_mixed,case_reserved_prefix,case_kelvin,case_dotted_capital_i, andcase_resolve_exact,case_resolve_single,case_resolve_ambiguous,case_resolve_kelvin, which split on/into a requested name and its siblings).
- Lowercase on store (Hive, Glue, Unity Catalog objects). The simplest rule and the best fit for Glue. It discards the spelling a source system chose, and existing mixed-case names would need renaming, which the object-prefix layout forbids because the name is in every file's path. It stays available later as a per-catalog tightening: CPCI guarantees lowercasing loses nothing.
- Case-sensitive, with a shim in each client (hoglake before this change). The DuckDB extension has written one, and the server has patched three places of its own. The shim Trino's Iceberg REST catalog uses lists remote names and caches the mapping; against hoglake that is the table listing, 9 MiB unpaged on a 54,000-table namespace (AGENT.md, Working conventions).
- A Unicode-aware collation (Lakekeeper's ICU
und-u-ks-level2). It needs every client to fold as ICU does, and Trino does not. - Echo the requested spelling (Lakekeeper). Clients build object paths from response names.
- A stored folded column (
name_foldedbesidename). It is a second copy of a fact the name already holds, and it has to be kept equal on every write. PostgreSQL indexes the expression instead. Hoglite cannot add a column to tenants that exist, andNOCASEneeds none. - The catalog disambiguates colliding fields (a suffix, or a spill into VARIANT). A writer may; the catalog would be inventing column names nobody asked for.
- What does a deployment holding a legacy pair do at the unique migration? The build fails and rolls back, and the server cannot boot until the pair is renamed. Proposed: the release that carries the migration names the three audits of the last rollout step as its prerequisite, and it does not ship until PostHog's own environments are empty.
ambiguous_nameas 422 or 409? Decided: 422. The request names nothing the server can act on, and retrying does not change that.- Should pyhoglake match Arrow column names by fold? Today a
column the table does not spell exactly is refused. Exact matching
is safe and stricter; a fold match is unambiguous once the rule
holds. Decided: exact; the refusal names the fold-equal column
(pyhoglake's
_align_table). - A lowercase-only catalog option for catalogs that will be registered in Glue. Not now.
- How many live tables does the largest Hoglite tenant hold? A
tenant created before the
NOCASEindexes scans its namespace's live tables on a lookup at head and its namespace's version history on a lookup at a snapshot (Hoglite). The cost per lookup is measured (the timing tables there; about 9 ms against 1.8 ms among 40,001 tables); the tenant count is still unknown. A tenant upgrade that adds the four indexes comes first if it is in the tens of thousands.
Read-only. The column query reads every live hog_column row, so run
it on a replica or with a statement timeout. Both sets were run against
seeded fixtures: server/schema.sql on PostgreSQL 18.7, and tables with
the tenant schema's columns on SQLite 3.46.1 (not a hoglite tenant).
PostgreSQL, case-only pairs:
-- namespaces
SELECT c.name AS catalog, array_agg(n.name ORDER BY n.name) AS names
FROM hog_namespace n JOIN hog_catalog c USING (catalog_id)
WHERE NOT n.dropped
GROUP BY c.name, lower(n.name COLLATE "C")
HAVING count(*) > 1;
-- tables
SELECT c.name AS catalog, n.name AS namespace,
array_agg(tv.name ORDER BY tv.name) AS names
FROM hog_table_version tv
JOIN hog_table t USING (catalog_id, table_id)
JOIN hog_namespace n USING (catalog_id, namespace_id)
JOIN hog_catalog c USING (catalog_id)
WHERE tv.end_snapshot IS NULL AND t.dropped_snapshot IS NULL AND NOT n.dropped
GROUP BY c.name, n.name, lower(tv.name COLLATE "C")
HAVING count(*) > 1;
-- views
SELECT c.name AS catalog, n.name AS namespace,
array_agg(v.name ORDER BY v.name) AS names
FROM hog_view v
JOIN hog_namespace n USING (catalog_id, namespace_id)
JOIN hog_catalog c USING (catalog_id)
WHERE v.end_snapshot IS NULL AND NOT n.dropped
GROUP BY c.name, n.name, lower(v.name COLLATE "C")
HAVING count(*) > 1;
-- sibling columns; parent_field_id is NULL for top-level columns
SELECT c.name AS catalog, n.name AS namespace, tv.name AS "table",
col.parent_field_id, array_agg(col.name ORDER BY col.name) AS names
FROM hog_column col
JOIN hog_table t USING (catalog_id, table_id)
JOIN hog_table_version tv
ON tv.catalog_id = col.catalog_id AND tv.table_id = col.table_id
AND tv.end_snapshot IS NULL
JOIN hog_namespace n
ON n.catalog_id = tv.catalog_id AND n.namespace_id = tv.namespace_id
JOIN hog_catalog c ON c.catalog_id = col.catalog_id
WHERE col.end_snapshot IS NULL AND t.dropped_snapshot IS NULL
GROUP BY c.name, n.name, tv.name, col.table_id, col.parent_field_id,
lower(col.name COLLATE "C")
HAVING count(*) > 1;PostgreSQL, a table and a view sharing a name, in the same spelling or another case:
SELECT c.name AS catalog, n.name AS namespace,
tv.name AS "table", v.name AS view
FROM hog_table_version tv
JOIN hog_table t USING (catalog_id, table_id)
JOIN hog_view v
ON v.catalog_id = tv.catalog_id AND v.namespace_id = tv.namespace_id
AND lower(v.name COLLATE "C") = lower(tv.name COLLATE "C")
JOIN hog_namespace n
ON n.catalog_id = tv.catalog_id AND n.namespace_id = tv.namespace_id
JOIN hog_catalog c ON c.catalog_id = tv.catalog_id
WHERE tv.end_snapshot IS NULL AND t.dropped_snapshot IS NULL
AND v.end_snapshot IS NULL AND NOT n.dropped;PostgreSQL, live version rows on dropped tables. The unique folded
index on hog_table_version is partial on end_snapshot IS NULL alone,
so this must return nothing:
SELECT c.name AS catalog, tv.table_id, tv.name
FROM hog_table_version tv
JOIN hog_table t USING (catalog_id, table_id)
JOIN hog_catalog c USING (catalog_id)
WHERE tv.end_snapshot IS NULL AND t.dropped_snapshot IS NOT NULL;PostgreSQL, live names truffle cannot address today:
SELECT 'namespace' AS kind, count(*) FROM hog_namespace
WHERE NOT dropped AND name <> lower(name COLLATE "C")
UNION ALL
SELECT 'table', count(*)
FROM hog_table_version tv JOIN hog_table t USING (catalog_id, table_id)
WHERE tv.end_snapshot IS NULL AND t.dropped_snapshot IS NULL
AND tv.name <> lower(tv.name COLLATE "C")
UNION ALL
SELECT 'view', count(*) FROM hog_view
WHERE end_snapshot IS NULL AND name <> lower(name COLLATE "C");Hoglite, per tenant, case-only pairs:
SELECT group_concat(name, ', ') FROM namespaces
WHERE dropped_snapshot IS NULL
GROUP BY name COLLATE NOCASE HAVING count(*) > 1;
SELECT namespace, group_concat(name, ', ') FROM tables
WHERE dropped_snapshot IS NULL
GROUP BY namespace, name COLLATE NOCASE HAVING count(*) > 1;
SELECT namespace, group_concat(name, ', ') FROM views
WHERE dropped_snapshot IS NULL
GROUP BY namespace, name COLLATE NOCASE HAVING count(*) > 1;
SELECT table_id, parent_field_id, group_concat(name, ', ') FROM columns
WHERE end_snapshot IS NULL
GROUP BY table_id, parent_field_id, name COLLATE NOCASE HAVING count(*) > 1;Hoglite, per tenant, a table and a view sharing a name:
SELECT t.namespace, t.name AS "table", v.name AS view
FROM tables t
JOIN views v
ON v.namespace = t.namespace AND v.name = t.name COLLATE NOCASE
WHERE t.dropped_snapshot IS NULL AND v.dropped_snapshot IS NULL;