Skip to content

Roles metadata is missing #350

Description

@luantranminh

Hi Spanner team, I hit this with the emulator while testing database roles.

Summary

The emulator accepts CREATE ROLE, but the role does not show up in role metadata. Real Spanner shows the same role in GetDatabaseDdl, INFORMATION_SCHEMA.ROLES, and databaseRoles.list.

Environment

  • Emulator version: 1.5.53

Repro

SPANNER_EMULATOR_HOST=localhost:9010 \
gcloud spanner databases create db \
  --instance=test-instance \
  --project=my-project

SPANNER_EMULATOR_HOST=localhost:9010 \
gcloud spanner databases ddl update db \
  --instance=test-instance \
  --project=my-project \
  --ddl='CREATE ROLE my-super-role'

SPANNER_EMULATOR_HOST=localhost:9010 \
gcloud spanner databases ddl update db \
  --instance=test-instance \
  --project=my-project \
  --ddl='CREATE SCHEMA s'

  Schema updating...
.....done.

Actual

GetDatabaseDdl shows the schema but not the role:

SPANNER_EMULATOR_HOST=localhost:9010 \
gcloud spanner databases ddl describe db \
  --instance=test-instance \
  --project=my-project
CREATE SCHEMA s;

databaseRoles.list returns 501:

SPANNER_EMULATOR_HOST=localhost:9010 \
gcloud spanner databases roles list \
  --instance=test-instance \
  --database=db \
  --project=my-project \
  --format=json
status: 501
content: {"code":12}

INFORMATION_SCHEMA.ROLES returns 500:

SPANNER_EMULATOR_HOST=localhost:9010 \
gcloud spanner databases execute-sql db \
  --instance=test-instance \
  --project=my-project \
  --sql='SELECT ROLE_NAME FROM INFORMATION_SCHEMA.ROLES ORDER BY ROLE_NAME' \
  --format=json
status: 500
content: {"code": 13, "message": "failed to marshal error message"}
SPANNER_EMULATOR_HOST=localhost:9010 \
gcloud spanner databases execute-sql db \
  --instance=test-instance \
  --project=my-project \
  --sql='SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA' \
  --format=json
{
  "rows": [
    [""],
    ["INFORMATION_SCHEMA"],
    ["SPANNER_SYS"],
    ["s"]
  ]
}

Expected

After CREATE ROLE my-super-role succeeds, my-super-role should be visible through the same metadata surfaces as real Spanner:

  • GetDatabaseDdl
  • INFORMATION_SCHEMA.ROLES
  • databaseRoles.list

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions