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
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
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!
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 inGetDatabaseDdl,INFORMATION_SCHEMA.ROLES, anddatabaseRoles.list.Environment
Repro
Actual
GetDatabaseDdlshows the schema but not the role:databaseRoles.listreturns 501:INFORMATION_SCHEMA.ROLESreturns 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=jsonSPANNER_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-rolesucceeds,my-super-roleshould be visible through the same metadata surfaces as real Spanner:GetDatabaseDdlINFORMATION_SCHEMA.ROLESdatabaseRoles.listThanks!