Skip to content

sql: ALTER TABLE statement issued by tenant cannot find relation #49318

@asubiotto

Description

@asubiotto

Modifying the logic test harness to set an explicit tenant ID:

diff --git a/pkg/server/testserver.go b/pkg/server/testserver.go
index 67d805b16f..9a7490c1a7 100644
--- a/pkg/server/testserver.go
+++ b/pkg/server/testserver.go
@@ -527,7 +527,14 @@ func testSQLServerArgs(ts *TestServer) sqlServerArgs {
 // StartTenant starts a SQL tenant communicating with this TestServer.
 func (ts *TestServer) StartTenant() (addr string, _ error) {
        ctx := context.Background()
+       if _, err := ts.InternalExecutor().(*sql.InternalExecutor).Exec(
+               ctx, "testserver-create-tenant", nil /* txn */, "SELECT crdb_internal.create_tenant(10)",
+       ); err != nil {
+               return "", err
+       }
+
        args := testSQLServerArgs(ts)
+       args.tenantID = roachpb.MakeTenantID(10)

And running the following test:

# LogicTest: 3node-tenant

statement ok
CREATE TABLE x (x int)

statement ok
INSERT INTO x VALUES (1)

query I
SELECT * FROM x
----
1

statement error operation is unsupported
ALTER TABLE x CONFIGURE ZONE USING num_replicas = 123

Fails on the ALTER TABLE statement.

        expected:
        operation is unsupported
        got:
        pq: relation "x" does not exist

cc @tbg @nvanbenschoten

Metadata

Metadata

Assignees

Labels

A-multitenancyRelated to multi-tenancyC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions