Repository navigation
Conversation
Dropping a sequence referenced by a column DEFAULT requires detaching the column default before executing DROP SEQUENCE. Add a standalone spanner_postgresql_drop_sequence sample and test suite.
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new Python script and corresponding tests to detach a column default and drop a PostgreSQL sequence in a Spanner database using DDL statements. The implementation includes error handling for failed preconditions and API call errors, as well as a command-line interface. There are no review comments, and I have no feedback to provide.
amcolin
left a comment
There was a problem hiding this comment.
Code looks ok to me just one small non-blocking suggestion.
| f"on database '{database_id}' in instance '{instance_id}': {err.message}", | ||
| file=sys.stderr, | ||
| ) | ||
| except exceptions.GoogleAPICallError as err: |
There was a problem hiding this comment.
Should the timeout error be caught as well?
except TimeoutError as err:
print(
f"error: timed out waiting to drop PostgreSQL sequence "
f"'{sequence_name}' on database '{database_id}' in instance "
f"'{instance_id}': {err}",
file=sys.stderr,
)There was a problem hiding this comment.
Yes, good catch, thank you! Since this PR was already merged into its base branch, I added the except TimeoutError handler and a unit test as a follow-up commit there (43569d5, part of #14851). The message notes that only the wait timed out and the operation may still be running, because the timeout does not cancel the schema change.
637268f
into
feat/spanner-postgresql-dml-last-statement
Description
Adds
spanner_postgresql_drop_sequencedetaching a columnDEFAULTand dropping a PostgreSQL bit-reversed sequence via DDL.Checklist
Testing
Compliance & Style
spanner/, which the default repository owners cover.Post-Approval Actions