Skip to content

sql: make TestDropFunction work with test tenant#160520

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:mt-TestDropFunction
Jan 6, 2026
Merged

sql: make TestDropFunction work with test tenant#160520
craig[bot] merged 1 commit intocockroachdb:masterfrom
rafiss:mt-TestDropFunction

Conversation

@rafiss
Copy link
Copy Markdown
Collaborator

@rafiss rafiss commented Jan 6, 2026

Previously, TestDropFunction hard-coded descriptor IDs (e.g., 109 for the function, 104-108 for tables/sequences/views/types) which only work when run against the system tenant. When running against a secondary tenant, these IDs are different because tenants have their own descriptor ID space.

This commit fixes the test by querying object IDs programmatically:

  • Table, sequence, and view IDs via sqlutils.QueryTableID
  • Function ID via crdb_internal.create_function_statements
  • Type IDs via regtype casts with catid.UserDefinedOIDToID conversion

The test now works correctly with both system and secondary tenants.

Resolves: #107322
Epic: None

Release note: None

Previously, TestDropFunction hard-coded descriptor IDs (e.g., 109 for
the function, 104-108 for tables/sequences/views/types) which only work
when run against the system tenant. When running against a secondary
tenant, these IDs are different because tenants have their own
descriptor ID space.

This commit fixes the test by querying object IDs programmatically:
- Table, sequence, and view IDs via sqlutils.QueryTableID
- Function ID via crdb_internal.create_function_statements
- Type IDs via regtype casts with catid.UserDefinedOIDToID conversion

The test now works correctly with both system and secondary tenants.

Resolves: cockroachdb#107322
Epic: None

Release note: None
@rafiss rafiss requested a review from a team as a code owner January 6, 2026 04:15
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@spilchen spilchen left a comment

Choose a reason for hiding this comment

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

LGTM

@rafiss
Copy link
Copy Markdown
Collaborator Author

rafiss commented Jan 6, 2026

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 6, 2026

@craig craig bot merged commit d0eca62 into cockroachdb:master Jan 6, 2026
24 of 25 checks passed
@rafiss rafiss deleted the mt-TestDropFunction branch January 7, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sql: make TestDropFunction work with test tenant

3 participants