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

show create generates invalid default values for columns #125

Open
jeroenpf opened this issue Jul 17, 2024 · 0 comments
Open

show create generates invalid default values for columns #125

jeroenpf opened this issue Jul 17, 2024 · 0 comments

Comments

@jeroenpf
Copy link
Contributor

jeroenpf commented Jul 17, 2024

The default column values in create table statements after running show create table contain invalid default values that do not correspond to the original tables.

A non-exhaustive list of examples:

  • timestamp/datetime NOT NULL without a default value appears with the default value 0 in the resulting create statement.
  • decimal(x,y) NOT NULL without a default value appears with a default value 0 in the resulting create statement.
  • bigint(x) NOT NULL 0 appears without a default value in the resulting create statement

This issue seems to happen when we run create statements and force NOT NULL columns to always have a default value. This is likely necessary for compatibility with WordPress queries that don't expect strict checks. We could consider storing the original default value (if any) in the _mysql_data_types_cache table and use that as the source of truth when we run show create queries.

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

No branches or pull requests

1 participant