Repository navigation
fix(bigquery): render GoogleSQL column type changes and escapes - #1341
Merged
Merged
Conversation
ALTER COLUMN now uses SET DATA TYPE. String literals and quoted identifiers escape quotes, backticks, backslashes and line breaks with a backslash, as GoogleSQL requires, instead of doubling the quote.
BigQuery column names may contain an apostrophe, and stored compatibility view definitions spell it raw. Escaping it changed the rendered SQL, so the janitor no longer recognised existing views. Identifiers now escape only backslashes, backticks and line breaks.
kvlonge
enabled auto-merge (squash)
November 7, 2026 08:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two BigQuery renderings produce SQL that BigQuery rejects:
ALTER COLUMN c TYPE T; GoogleSQL requiresSET DATA TYPE T.'it''s',`ab``). GoogleSQL escapes only with a backslash, so values with a quote, backslash or line break failed, including JSON text containing"`.Changes
render_alter_column_typesemitsSET DATA TYPE.\,', CR and LF in_escape_sql_stringand_quote_sql_string, so typed scalars, value lists, arrays, typed objects, loader literals and INFORMATION_SCHEMA filters follow it. Typed STRING scalars no longer fall through to the ANSI doubling renderer.render_identifierescapes\,`, CR and LF and keeps'raw: BigQuery column names may contain an apostrophe, and the janitor matches stored compatibility view definitions against freshly rendered SQL.SET DATA TYPE.DuckShop: not applicable. DuckShop runs on DuckDB and never emits BigQuery SQL.
Verification
TYPE NUMERICand'it''s') and pass with the fix.view_definitions_matchstill accepts a stored definition with it.tests/unit/src/sqlbuild/adapters,tests/unit/src/sqlbuild/adapter,tests/integration/src/sqlbuild/adaptersand the migrations unit tests pass.SET DATA TYPEstatement, and every literal and the backtick identifier decode to the original value code point for code point.make check-ciand the public-repository scan.