Skip to content

updates - #37960

Merged
kay-kim merged 1 commit into
MaterializeInc:docs/upstream-schema-change-behaviorfrom
kay-kim:docs/upstream-schema-change-behavior
Jul 30, 2026
Merged

updates#37960
kay-kim merged 1 commit into
MaterializeInc:docs/upstream-schema-change-behaviorfrom
kay-kim:docs/upstream-schema-change-behavior

Conversation

@kay-kim

@kay-kim kay-kim commented Jul 29, 2026

Copy link
Copy Markdown
Contributor
  • incorporate legacy into the shortcode.
  • clarify actions.

@kay-kim
kay-kim requested a review from a team as a code owner July 29, 2026 22:01
---
headless: true
---
### Schema changes (legacy source syntax)

@kay-kim kay-kim Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this headless content is used in the create source legacy syntax and the ingest data/mysql/ landing page.

So ... broke into legacy schema and consideration body ... so that the

  • the create source legacy page can remain the same
  • the ingest data/mysql landing page can have just the non-schema consideration body along with the new shortcode.

Q: Do we want to include the shortcode in the sql create source/table (new + old) as well?

@martykulma martykulma Jul 30, 2026

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.

I have another PR that I drafted (have to review because I've forgotten what I did there)

#37684

If you do the shortcode, it seems it would dovetail into my changes.

- Dropping columns that were added after the source was created. These columns
are never ingested, so you can drop them without issue.

- Adding or removing `NOT NULL` constraints to tables that were nullable when

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ditto with this file. Except removed this last bullet since this isn't true.

via the `TEXT COLUMNS` option. Ingestion for that table stops, and you must
drop and recreate the table in Materialize to resume ingestion.
{{ else if eq $connector "mysql" -}}
Changing a column's data type to one that maps to a different Materialize type

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

heh heh ... had to reword ... AI thought it meant like if you had upstream varchar and that mapped to MZ text. It all thanked me for the clarification stating that it had understood it to mean that. I was thinking "Um... didn't you write it?" (but, it had then, "verified" something else in the code and concluded shenanigans ... so I had to fight that battle instead).

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.

whoops - yeah, the check is only skipped if someone used the explicit TEXT COLUMNS!

*/ -}}
{{- $connector := .Get "connector" -}}
{{- $is_postgres := eq $connector "postgres" -}}

@kay-kim kay-kim Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@maheshwarip @martykulma - can you all review this page. I had to update and want to make sure I didn't go shenanigans.

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

Awesome, thanks @kay-kim! I realized I had left out a reason for SQL Server to error - capture instance could get removed.

Also discovered that we have a bug in the code around SQL Server constraints. Would be nice to doc the correct/expected behavior today (which is that PRIMARY KEY and UNIQUE constraints being dropped for SQL Server will cause an error).

edit: actually, it turns out that if CDC was enabled when the PRIMARY KEY existed, SQL Server won't let you drop it.

Comment on lines +74 to +76
Materialize ignores the following constraint changes: foreign key, `CHECK`,
`UNIQUE`, and `PRIMARY KEY` constraints. As such, you can add or drop them
without affecting ingestion.

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.

This turns out to be true for SQL Server today, but actually a bug. A constraint change for a table isn't logged in the ddl_history, so it goes unnoticed. 😬

I'm filing a bug that we will fix, but maybe we should doc that it will fail?

via the `TEXT COLUMNS` option. Ingestion for that table stops, and you must
drop and recreate the table in Materialize to resume ingestion.
{{ else if eq $connector "mysql" -}}
Changing a column's data type to one that maps to a different Materialize type

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.

whoops - yeah, the check is only skipped if someone used the explicit TEXT COLUMNS!

state. Ingestion for that table stops, and you must drop and recreate the table
in Materialize to resume ingestion.

### Table-level operations

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.

For SQL Server, removing the capture instance Materialize is using (which is done via sys.sp_cdc_disable_table) will also cause a stall. SQL Server allows 2 capture instances to exist for a table, and removing the one MZ isn't using is OK.

@kay-kim

kay-kim commented Jul 30, 2026

Copy link
Copy Markdown
Contributor Author

Sounds good. What I'll do is:

  • Merge this into the claude's branch (which has the PR to merge into main).
  • From there, I'll add a patch to address Marty's helpful feedback.
    • Incorporate shortcode in the specific sql reference pages.
    • SQL Server:
      • Mention removing capture instance MZ is using causes a stall; removing capture instance not being used is okay.
      • UNIQUE constraints being dropped for SQL Server will cause an error
      • Adjust wording for PRIMARY KEY ... since if CDC was enabled when the PRIMARY KEY existed, SQL Server won't let you drop it.

@kay-kim
kay-kim merged commit a4f37aa into MaterializeInc:docs/upstream-schema-change-behavior Jul 30, 2026
26 checks passed
@kay-kim
kay-kim deleted the docs/upstream-schema-change-behavior branch July 30, 2026 16:47
kay-kim added a commit that referenced this pull request Jul 31, 2026
- incorporate legacy into the shortcode.
- clarify actions.
kay-kim added a commit that referenced this pull request Jul 31, 2026
- incorporate legacy into the shortcode.
- clarify actions.
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.

2 participants