Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: exclude anonymous database from pg_catalog and pg_extension schemas in TableName.FQString() #105929

Closed
ecwall opened this issue Jun 30, 2023 · 0 comments
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@ecwall
Copy link
Contributor

ecwall commented Jun 30, 2023

"".pg_extension.spatial_ref_sys is the output of TableName.FQString() for spatial_ref_sys which results in an error when trying to use the value:

[email protected]:26257/movr> SELECT count(*) FROM pg_extension.spatial_ref_sys;                                                                                                                                                          
  count
---------
   6139
(1 row)

Time: 17ms total (execution 17ms / network 0ms)

[email protected]:26257/movr> SELECT count(*) FROM "".pg_extension.spatial_ref_sys;                                                                                                                                                       
ERROR: cannot access virtual schema in anonymous database
SQLSTATE: 42704
HINT: verify that the current database is set

Remove the "". prefix to fix this.

Jira issue: CRDB-29276

@ecwall ecwall added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Jun 30, 2023
@ecwall ecwall self-assigned this Jun 30, 2023
@craig craig bot closed this as completed in b3c2312 Jul 5, 2023
blathers-crl bot pushed a commit that referenced this issue Jul 5, 2023
…mas in TableName.FQString()

Fixes #105929

`"".pg_extension.spatial_ref_sys` is the output of `TableName.FQString()` for
`spatial_ref_sys` which results in an error when trying to use the value:

```
[email protected]:26257/movr> SELECT count(*) FROM pg_extension.spatial_ref_sys;
  count
---------
   6139
(1 row)

Time: 17ms total (execution 17ms / network 0ms)

[email protected]:26257/movr> SELECT count(*) FROM "".pg_extension.spatial_ref_sys;
ERROR: cannot access virtual schema in anonymous database
SQLSTATE: 42704
HINT: verify that the current database is set
```

This PR fixes this by removing the `"".` prefix.

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. db-cy-23 T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

1 participant