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

table("public.my_table").drop() does not work #1982

Closed
olavloite opened this issue Jan 15, 2024 · 0 comments · Fixed by #2036
Closed

table("public.my_table").drop() does not work #1982

olavloite opened this issue Jan 15, 2024 · 0 comments · Fixed by #2036
Assignees
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@olavloite
Copy link
Contributor

Dropping a table by calling the following will fail when using PostgreSQL:

const instance = spanner.instance('my-instance');
const database = instance.database('my-database');
const table = database.table('public.Singers');
table.delete();

The reason is that this line fails to take two things into consideration:

  1. PostgreSQL uses " (double quotes) to quote identifiers, and not ` (backtick).
  2. If the table name is prefixed with a schema name, then the entire string is quoted, instead of the schema name and table name separately.

The output is:

  • Current: DROP TABLE `public.Singers`
  • Expected: DROP TABLE "public"."Singers"
@olavloite olavloite added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Jan 15, 2024
@product-auto-label product-auto-label bot added the api: spanner Issues related to the googleapis/nodejs-spanner API. label Jan 15, 2024
@surbhigarg92 surbhigarg92 self-assigned this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants