Skip to content

Make dbinit.sql slightly less order-dependent#4288

Merged
smklein merged 5 commits into
mainfrom
dbinit-order
Oct 18, 2023
Merged

Make dbinit.sql slightly less order-dependent#4288
smklein merged 5 commits into
mainfrom
dbinit-order

Conversation

@smklein

@smklein smklein commented Oct 17, 2023

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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

smklein commented Oct 17, 2023

Copy link
Copy Markdown
Collaborator Author

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.

@david-crespo david-crespo left a comment

Copy link
Copy Markdown
Contributor

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.

@bnaecker bnaecker left a comment

Copy link
Copy Markdown
Collaborator

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
@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