docs: document source behavior on upstream schema changes and destructive operations#37842
docs: document source behavior on upstream schema changes and destructive operations#37842claude[bot] wants to merge 8 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYKBA8c2X2KsdFqhMQQDN7
|
SQL server prevents users from running truncate against the upstream table when CDC is enabled, so that path is not reachable. If a user attempt to truncate a CDC enabled table, the command fails with error 4711 - Cannot truncate table '%.*ls' because it is published for replication or enabled for Change Data Capture. |
|
Thanks — updated: dropped the Generated by Claude Code |
|
Read through all the documentation carefully and validate that it makes sense. For instance, the page for MySQL now has two sections for schema changes. Think about how to incorporate this gracefully @claude . Bear in mind the legacy syntax and the new syntax. |
|
Claude finished @maheshwarip's task in 2m 42s —— View job Reviewing documentation for duplication issues
Finding: All three pages (Postgres, MySQL, SQL Server) already had a Fix (pushed in cb0d018): Renamed
Readers now see clearly that the Considerations block covers the old subsource-based syntax, while the new top-level section covers current |
|
@claude please also expand the "Type changes" into its own subheading, much like "Add a column" and "Drop a column" |
Rename the existing '### Schema changes' headings inside the Considerations includes to '### Schema changes (legacy source syntax)' so that readers are not confused by two schema-change sections on each ingestion page: the legacy-subsource-focused block in Considerations now clearly signals its scope, while the new '## Upstream schema changes and destructive operations' section covers current CREATE TABLE FROM SOURCE behavior. Co-authored-by: Pranshu Maheshwari <maheshwarip@users.noreply.github.com>
|
Claude finished @maheshwarip's task in 56s —— View job Tasks
Done. Pushed in
|
Move the per-connector column-type-change details out of the "Operations that require recreating the table" bullet list and into a dedicated "### Changing a column's data type" section, consistent with the "### Adding a column" and "### Dropping a column" subheadings. Co-authored-by: Pranshu Maheshwari <maheshwarip@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XYKBA8c2X2KsdFqhMQQDN7
Requested by Pranshu Maheshwari · Slack thread
Motivation
A customer asked what happens to a Materialize source when the upstream table undergoes schema changes or destructive operations. This documents that behavior on the primary Postgres, MySQL, and SQL Server ingestion pages.
Description
Added a single reusable include — a new parameterized Hugo shortcode
doc/user/layouts/shortcodes/upstream-schema-change-behavior.html— describing add-column / drop-column / constraint changes / error-state operations, and wired it into the three_index.mdprimary pages (postgres,mysql,sql-server) under a new## Upstream schema changes and destructive operationssection placed after## Considerations. The shortcode takes aconnectorparam and is called as{{% upstream-schema-change-behavior connector="..." %}}; source-versioning links are built from the connector so each page links to its own guide. This keeps a single source of truth for the prose (modeled on the existingsource-versioning-disambiguation.html"parameterize by variant" pattern) rather than three copies.PUBLICATION and REPLICA IDENTITY operations, and
EXCLUSIONconstraints, are gated with{{ if eq (.Get "connector") "postgres" }}to render only on the Postgres page, since MySQL (GTID binlog) and SQL Server (CDC capture instances) have no such concepts.The "Changing a column's data type" error-state bullet now renders per-connector, since the behavior differs by upstream. Postgres errors on any type change except changing it to
text. MySQL only errors when the new type maps to a different Materialize type. Changes within the same Materialize type (for exampletinyint↔smallint, thetext/tinytext/mediumtext/longtextfamily, or adjustingbit(n)precision) do not error, and appending values to an existing enum is safe while removing enum values errors. SQL Server errors on anyALTER COLUMN. This was clarified by the MySQL and SQL Server SME.Resolved caveat:
TRUNCATEagainst a CDC-enabled upstream table, which fails with error 4711 ("Cannot truncate table ... because it is published for replication or enabled for Change Data Capture"). The truncate-error path is therefore not reachable on SQL Server, so the "Truncating a table" bullet is intentionally omitted from the SQL Server page. It stays on the Postgres and MySQL pages, which both allow the operation and have documented truncation restrictions.Verification
Built the site locally with the pinned Hugo extended v0.152.2 (
hugofromdoc/user). Build succeeded with exit 0, 604 pages rendered, no template/shortcode errors. Grepped the generatedpublic/output per connector to confirm the gating:ingest-data/postgres/index.html: PUBLICATION, REPLICA IDENTITY, and EXCLUSION all present; rendered constraint line reads "foreign key andCHECKandEXCLUSIONconstraints";DROP TABLEbullet includes theALTER PUBLICATION ... DROP TABLE/DROP PUBLICATIONclause.ingest-data/mysql/index.htmlandingest-data/sql-server/index.html: PUBLICATION, REPLICA IDENTITY, and EXCLUSION all absent (0 occurrences); constraint line reads "foreign key andCHECKconstraints"./ingest-data/{connector}/source-versioning/#handle-upstream-column-{addition,drop}).