Skip to content

adapter: decide cluster restriction by schema identity, not name#37645

Merged
ggevay merged 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/sql-434-check-cluster-restrictions-id-based
Jul 15, 2026
Merged

adapter: decide cluster restriction by schema identity, not name#37645
ggevay merged 1 commit into
MaterializeInc:mainfrom
ggevay:gabor/sql-434-check-cluster-restrictions-id-based

Conversation

@ggevay

@ggevay ggevay commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes SQL-434

Motivation

The mz_catalog_server cluster is reserved for system catalog queries, so user objects must not be queryable from it. check_cluster_restrictions decided whether an item is a system item by matching its bare schema name against the system schema names. A user-created schema named information_schema, the one system schema name not blocked by the mz_/pg_ prefix reservation, therefore let user objects slip past the restriction and run on mz_catalog_server.

Description

Decide by the schema's identity instead of its name: check the item's SchemaSpecifier with SessionCatalog::is_system_schema_specifier, which resolves against the ambient system schemas' IDs. A name-colliding user schema has a user schema ID and is now correctly rejected. This matches how auto_run_on_catalog_server in the same module already makes the decision.

🤖 Generated with Claude Code

check_cluster_restrictions classified an item as a system item by
matching its bare schema name against the system schema names. A
user-created schema named information_schema, the one system schema
name not blocked by the mz_/pg_ prefix reservation, therefore let user
objects be queried from the mz_catalog_server cluster. Check the item's
schema specifier instead, which identifies the ambient system schemas
regardless of name collisions, matching how auto_run_on_catalog_server
already decides.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ggevay ggevay added the A-ADAPTER Topics related to the ADAPTER layer label Jul 14, 2026
@ggevay ggevay marked this pull request as ready for review July 14, 2026 19:13
@ggevay ggevay requested a review from a team as a code owner July 14, 2026 19:13
@ggevay ggevay merged commit ab10152 into MaterializeInc:main Jul 15, 2026
125 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ADAPTER Topics related to the ADAPTER layer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants