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

Support non-nullable generated column #84

Merged
merged 2 commits into from
Jun 3, 2023

Conversation

toga4
Copy link
Contributor

@toga4 toga4 commented Oct 15, 2022

WHAT

Add support for inserting into table contains non-nullable generated columns.

WHY

Currently, handy-spanner gives an error if the inserting column is insufficient against the non-nullable columns

% handy-spanner &
[1] 38441
2022/10/15 15:13:04 spanner server is ready

% SPANNER_EMULATOR_HOST=localhost:9999 spanner-cli -p fake -i fake -d fake
Connected.
spanner> CREATE TABLE foobar (
      ->   id INT64 NOT NULL,
      ->   value STRING(MAX) NOT NULL AS (CAST(id AS STRING)) STORED,
      -> ) PRIMARY KEY(id);
Query OK, 0 rows affected (0.01 sec)

spanner> INSERT INTO foobar (id) VALUES (1);
ERROR: spanner: code = "FailedPrecondition", desc = "A new row in table foobar does not specify a non-null value for these NOT NULL columns: value"

This PR allows to insert without specifying columns with non-nullable but generated.

@kazegusuri kazegusuri merged commit 7d02417 into gcpug:master Jun 3, 2023
@kazegusuri
Copy link
Collaborator

Thank you for your contribution. Nice improvements and tests. It's enough to merge but there is a conflict. I added a commit to fix the conflict on top of your commits then merged your PR.

@toga4 toga4 deleted the support-non-null-generated-column branch July 10, 2023 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants