dolthub / go-mysql-server

A MySQL-compatible relational database with a storage agnostic query engine. Implemented in pure Go.
Apache License 2.0
2.32k stars 199 forks source link

normalize column defaults #2629

Closed jycor closed 1 month ago

jycor commented 1 month ago

This PR adds a new analyzer rule to normalize literal column default values. This rule ensures that the default value is consistent for the column type (float defaults over int columns are rounded properly). It does this by evaluating the column default, and placing that into a NewLiteral of the proper type.

Additionally, this ensures that dolt serialization receives consistent values (normalized floats and proper types).

fixes: https://github.com/dolthub/dolt/issues/8190