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

fix UPDATE BYTES to default values #9

Merged
merged 2 commits into from
Apr 8, 2020

Conversation

nktks
Copy link
Contributor

@nktks nktks commented Apr 4, 2020

Hi!

I fixed case that updating BYTES default value when adding BYTES column with NOT NULL.

reproduce

schema diff

>   bytes BYTES(MAX) NOT NULL,

hammer diff

ALTER TABLE test ADD COLUMN bytes BYTES(MAX)
UPDATE test SET bytes = '' WHERE bytes IS NULL
ALTER TABLE test ALTER COLUMN bytes BYTES(MAX) NOT NULL

hammer apply error

Error: rpc error: code = InvalidArgument desc = Value of type STRING cannot be assigned to bytes, which has type BYTES [at 1:25]\nUPDATE test SET bytes = \'\' WHERE bytes IS NULL\n

return "''"
case spansql.Bytes:
return "CAST('' AS BYTES)"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!
I'll fix it.

@daichirata daichirata merged commit 9b280ef into daichirata:master Apr 8, 2020
@daichirata
Copy link
Owner

thank you so much 👍

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