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

Make dbinit.sql slightly less order-dependent #4288

Merged
merged 5 commits into from
Oct 18, 2023
Merged

Make dbinit.sql slightly less order-dependent #4288

merged 5 commits into from
Oct 18, 2023

Conversation

smklein
Copy link
Collaborator

@smklein smklein commented Oct 17, 2023

This PR does two things:

  1. It avoids checking for the order-dependent NOT NULL constraint in information schema, opting to parse the output of SHOW CONSTRAINTS and information_schema.columna.is_nullable instead.
  2. It re-orders the db_metadata creation to the end of dbinit.sql (mostly for clarity)

Fixes #4286

@gjcolombo
Copy link
Contributor

It re-orders the db_metadata creation to the end of dbinit.sql (mostly for clarity)

Hooray!

I've only skimmed the PR but will ask anyway: If this is now legal, is the guideline in the schema README to add new tables only to the end of dbinit.sql still relevant? (If it's not, we should remove it and consider replacing it with guidance that db_metadata should always be last.)

@smklein
Copy link
Collaborator Author

smklein commented Oct 17, 2023

It re-orders the db_metadata creation to the end of dbinit.sql (mostly for clarity)

Hooray!

I've only skimmed the PR but will ask anyway: If this is now legal, is the guideline in the schema README to add new tables only to the end of dbinit.sql still relevant? (If it's not, we should remove it and consider replacing it with guidance that db_metadata should always be last.)

Sure thing, I just pushed a small update to the schema/crdb README.

Copy link
Contributor

@david-crespo david-crespo left a comment

Choose a reason for hiding this comment

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

Looks good. I confirmed this change makes the schema tests pass in #4261.

Copy link
Collaborator

@bnaecker bnaecker left a comment

Choose a reason for hiding this comment

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

I don't have enough context to really approve, but I don't see any issues!

@smklein smklein merged commit 463cc1a into main Oct 18, 2023
21 checks passed
@smklein smklein deleted the dbinit-order branch October 18, 2023 16:11
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.

dbinit is getting too order dependent
4 participants