Skip to content

Conversation

@fulghum
Copy link
Contributor

@fulghum fulghum commented Jul 9, 2022

Operations that modify a table's schema were not consistently resolving column default values:

  • AlterPK was missed in resolve column default switch cases, and also wasn't considering its expressions when checking for resolution.
  • AlterDefaultSet was resolving the wrong schema (its output schema, OkResultSchema, instead of the target schema).

While I was in there, I cleaned up the code to more consistently use the sql.TargetSchema interface and combined some copy/pasted switch cases.

Updated existing tests to use column default values and verified they caught both of these failures. Have already run Dolt engine tests and verified they pass correctly.

Fixes: dolthub/dolt#3788

@fulghum fulghum marked this pull request as ready for review July 11, 2022 22:30
@fulghum fulghum requested a review from zachmu July 11, 2022 22:39
@fulghum fulghum requested review from andy-wm-arthur and removed request for zachmu July 19, 2022 16:00
Copy link
Contributor

@andy-wm-arthur andy-wm-arthur left a comment

Choose a reason for hiding this comment

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

LGTM!

@fulghum fulghum merged commit 7a5497e into main Jul 19, 2022
@Hydrocharged Hydrocharged deleted the fulghum/alterpk-panic branch October 13, 2022 12:51
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.

Panic when altering the PK on a table with column defaults

2 participants