From 34748dc7f540325f6906ab820f05bea822773e6c Mon Sep 17 00:00:00 2001 From: "Ralph Sto. Domingo" Date: Sat, 28 Nov 2026 00:08:18 +0800 Subject: [PATCH 1/3] fix: read SQL text with escape strings, Unicode and quoted names - Postgres E'' strings end at an unescaped quote - itemName: Unicode names, `t.mod id` and `interval '' id` aliases; quotes unescape only their own - castColumn: `collate` keeps the name; nesting has a bound - One shared word list for the three guards Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BXxzvqLZuTJdDJ1Ku2ZMDY --- .../altimate/native/dbt/project-lineage.ts | 97 ++++++++++++++----- .../test/altimate/column-answer.test.ts | 46 ++++++++- 2 files changed, 113 insertions(+), 30 deletions(-) diff --git a/packages/opencode/src/altimate/native/dbt/project-lineage.ts b/packages/opencode/src/altimate/native/dbt/project-lineage.ts index b99b1f47b5..f1511e8ef1 100644 --- a/packages/opencode/src/altimate/native/dbt/project-lineage.ts +++ b/packages/opencode/src/altimate/native/dbt/project-lineage.ts @@ -79,10 +79,15 @@ export function stripAggFilter(sql: string): string { */ export function stripSql(sql: string): string { // A quoted name ("a--b", `c/*d`, [e--f]) is kept whole, so comment marks inside it start no comment. + // Postgres's escape string (E'it\'s') ends at an unescaped quote, not at a backslash-escaped one. return sql.replace( - /"(?:[^"]|"")*"|`(?:[^`]|``)*`|\[(?:[^\]]|\]\])*\]|'(?:[^']|'')*'|\$([A-Za-z_]\w*)?\$[\s\S]*?\$\1\$|--[^\r\n]*|\/\*[\s\S]*?\*\//g, + /"(?:[^"]|"")*"|`(?:[^`]|``)*`|\[(?:[^\]]|\]\])*\]|(? - match.startsWith('"') || match.startsWith("`") || match.startsWith("[") ? match : match.startsWith("'") || match.startsWith("$") ? "''" : " ", + match.startsWith('"') || match.startsWith("`") || match.startsWith("[") + ? match + : /^(?:[eE]?'|\$)/.test(match) + ? "''" + : " ", ) } @@ -92,7 +97,7 @@ export function hasNestedWith(sql: string): boolean { } const ENGINE_NAME = /^_(?:col_)?\d+$/i -const COLUMNS_CALL = /(? 0 && new Set(names).size === names.length } -const QUOTED = '"(?:[^"]|"")*"|`[^`]*`|\\[[^\\]]*\\]' -const unquoteName = (name: string) => name.replace(/^["`[]|["`\]]$/g, "").toLowerCase() +const QUOTED = '"(?:[^"]|"")*"|`(?:[^`]|``)*`|\\[(?:[^\\]]|\\]\\])*\\]' +/** A name's text, lower-cased; a quoted one loses its quotes and unescapes only its own doubled quote (`"a""b"` is a"b). */ +function unquoteName(name: string): string { + const q = name[0] + if (q === '"' || q === "`") return name.slice(1, -1).replaceAll(q + q, q).toLowerCase() + if (q === "[") return name.slice(1, -1).replaceAll("]]", "]").toLowerCase() + return name.toLowerCase() +} +/** A name's characters, unquoted: letters and digits in any script, `_` and `$`. */ +const NAME = "[\\p{L}\\p{N}_$]" /** * The items of the SQL's outermost SELECT list (the first one outside parentheses, so after any WITH), split at @@ -131,8 +144,9 @@ export function selectItems(stripped: string): string[] { if (ch === "(") depth++ else if (ch === ")") depth-- if (depth !== 0) continue - const word = /^[a-z_]+/i.exec(text.slice(i))?.[0]?.toLowerCase() - const boundary = i === 0 || !/[\w$]/.test(text[i - 1]!) + // A keyword is a whole name: `from` inside `éfrom` or `fromage` ends no list. + const word = /^[\p{L}\p{N}_$]+/u.exec(text.slice(i))?.[0]?.toLowerCase() + const boundary = i === 0 || !/[\p{L}\p{N}_$]/u.test(text[i - 1]!) if (start < 0) { if (boundary && word === "select") { start = i + 6 @@ -154,27 +168,42 @@ export function selectItems(stripped: string): string[] { return items.filter((one) => one !== "") } -/** Words that end an expression (`x is null`, `case … end`) rather than alias it. */ -const ENDS_EXPRESSION = /^(?:null|true|false|end)$/i -/** Words after which the next word is an operand (`a and b`, `sum(x) over w`), not an alias. */ -const TAKES_OPERAND = /^(?:and|or|not|is|in|like|ilike|rlike|regexp|similar|to|between|case|when|then|else|over|collate|escape|interval|distinct|by|as|at|zone|any|all|some|exists|div|mod|xor)$/i +/** Words that join, compare or qualify operands (`a and b`, `x is null`, `sum(x) over w`): never an alias, never a type. */ +const OPERATOR_WORDS = ["and", "or", "not", "is", "isnull", "notnull", "in", "like", "ilike", "rlike", "regexp", "similar", + "between", "case", "when", "then", "else", "over", "filter", "collate", "escape", "div", "mod", "xor", "any", "all", "some", "exists"] +/** Literal words: they end an expression (`x is null`, `case … end`), and a bare one is no column. */ +const LITERAL_WORDS = ["null", "true", "false", "end"] +const wordList = (list: string[]) => new RegExp(`^(?:${list.join("|")})$`, "i") +/** Words that end an expression rather than alias it. */ +const ENDS_EXPRESSION = wordList(LITERAL_WORDS) +/** Words after which the next word is an operand, not an alias: the operators, and words that take one (`interval`, `at time zone`). */ +const TAKES_OPERAND = wordList([...OPERATOR_WORDS, "to", "interval", "distinct", "by", "as", "at", "zone"]) +/** Words a type name never holds: an item with one after `::` is more than a cast (`amount::numeric is not null`). */ +const NOT_TYPE = wordList([...OPERATOR_WORDS, ...LITERAL_WORDS, "as", "at"]) +/** An interval's fields: after a complete interval literal (`interval '1' day`) the word is part of it, not an alias. */ +const INTERVAL_FIELD = /^(?:year|month|week|day|hour|minute|second|millisecond|microsecond|quarter|decade|century|millennium)s?$/i /** * A SELECT item's output name when the SQL gives one (`x as name`, `x name`, a bare `t.col`), `*` for a star, * else null. */ export function itemName(item: string): string | null { - if (/^(?:[\w$]+\.)*\*(?:\s|$)/.test(item)) return "*" - const as = new RegExp(`\\s+as\\s+(${QUOTED}|[\\w$]+)$`, "i").exec(item) + const part = `(?:${QUOTED}|${NAME}+)` + if (new RegExp(`^(?:${part}\\.)*\\*(?:\\s|$)`, "u").test(item)) return "*" + const as = new RegExp(`\\s+as\\s+(${part})$`, "iu").exec(item) if (as) return unquoteName(as[1]!) - const bare = new RegExp(`^(?:(?:${QUOTED}|[\\w$]+)\\.)*(${QUOTED}|[\\w$]+)$`).exec(item) + const bare = new RegExp(`^(?:${part}\\.)*(${part})$`, "u").exec(item) if (bare) return unquoteName(bare[1]!) // An alias without AS: the last word, after an expression that ends in a name, a `)`, a quote or a literal. - const plain = new RegExp(`^([\\s\\S]*?[\\w$)"\`\\]'])\\s+(${QUOTED}|[\\w$]+)$`).exec(item) + const plain = new RegExp(`^([\\s\\S]*?(?:${NAME}|[)"\`\\]']))\\s+(${part})$`, "u").exec(item) if (!plain) return null - const before = /([\w$]+)\s*$/.exec(plain[1]!)?.[1] - if ((before && TAKES_OPERAND.test(before)) || /(? t[k]?.kind === "punct" && t[k]!.text === text const word = (k: number, text: string) => t[k]?.kind === "name" && t[k]!.text.toLowerCase() === text const named = (k: number) => t[k]?.kind === "quoted" || t[k]?.kind === "name" @@ -277,9 +311,12 @@ export function castColumn(item: string): string | null { return at - start === 1 && ENDS_EXPRESSION.test(last.text) ? null : last.text.toLowerCase() } const operand = (): string | null => { + if ((punct(at, "(") || word(at, "cast")) && nesting >= CAST_NESTING) return null if (punct(at, "(")) { at++ + nesting++ const name = chain() + nesting-- if (name === null || !punct(at, ")")) return null at++ shaped = true @@ -287,7 +324,9 @@ export function castColumn(item: string): string | null { } if (word(at, "cast") && punct(at + 1, "(")) { at += 2 + nesting++ const name = chain() + nesting-- if (name === null || !word(at, "as")) return null at++ if (!type() || !punct(at, ")")) return null @@ -305,6 +344,12 @@ export function castColumn(item: string): string | null { if (!type()) return null shaped = true } + // A collation keeps the operand's name (`amount::text collate "C"` is amount). + if (word(at, "collate") && named(at + 1)) { + at += 2 + while (punct(at, ".") && named(at + 1)) at += 2 + shaped = true + } return name } @@ -318,7 +363,7 @@ export function castColumn(item: string): string | null { */ function columnsTemplates(stripped: string): Set { const out = new Set() - const call = new RegExp(COLUMNS_CALL.source, "gi") + const call = new RegExp(COLUMNS_CALL.source, "giu") // A quoted name is blanked whole, so a `)` or `columns(` inside one neither ends nor starts a call. const text = stripped.replace(new RegExp(QUOTED, "g"), (q) => " ".repeat(q.length)) for (let m = call.exec(text); m; m = call.exec(text)) { @@ -328,7 +373,7 @@ function columnsTemplates(stripped: string): Set { if (text[i] === "(") depth++ else if (text[i] === ")" && --depth === 0) break } - const alias = new RegExp(`^\\s*as\\s+(${QUOTED}|[\\w$]+)`, "i").exec(stripped.slice(i + 1)) + const alias = new RegExp(`^\\s*as\\s+(${QUOTED}|${NAME}+)`, "iu").exec(stripped.slice(i + 1)) if (alias && /\\\d/.test(alias[1]!)) out.add(unquoteName(alias[1]!)) } return out diff --git a/packages/opencode/test/altimate/column-answer.test.ts b/packages/opencode/test/altimate/column-answer.test.ts index 8cbc27fa1e..9d375ef07c 100644 --- a/packages/opencode/test/altimate/column-answer.test.ts +++ b/packages/opencode/test/altimate/column-answer.test.ts @@ -5,7 +5,7 @@ import { join } from "node:path" import { ENGINE, MAX_ANSWER_COLUMNS, columnAnswer, describeAnswer, type ColumnAnswer } from "../../src/altimate/native/dbt/column-answer" import { columnReach, namesColumn } from "../../src/altimate/native/dbt/column-reach" import { dbtLineage } from "../../src/altimate/native/dbt/lineage" -import { castColumn, clearLineageCaches, hasNestedWith, howOf, itemName, quotingIsClear, relationUse, shapeFlags, stripAggFilter, stripSql } from "../../src/altimate/native/dbt/project-lineage" +import { castColumn, clearLineageCaches, hasNestedWith, howOf, itemName, quotingIsClear, relationUse, selectItems, shapeFlags, stripAggFilter, stripSql } from "../../src/altimate/native/dbt/project-lineage" const dirs: string[] = [] afterEach(() => { @@ -1227,10 +1227,15 @@ describe("both tools: names at the edges", () => { }) test("an alias without AS is read, and the end of an expression isn't taken for one", () => { - const named = { "val id": "id", "count(*) n": "n", "t.col c2": "c2", "'' label": "label", '"My Col"': "my col", "a.b as c": "c", "f.*": "*" } + const named = { "val id": "id", "count(*) n": "n", "t.col c2": "c2", "'' label": "label", '"My Col"': "my col", "a.b as c": "c", "f.*": "*", + // An operator word after a dot is a column name; a complete interval literal can carry an alias. + "t.mod id": "id", "t.div total": "total", "interval '' id": "id", "interval 1 day total": "total", + // A quoted name drops its own doubled quote; Unicode names are names. + '"a""b"': 'a"b', 'x as "a""b"': 'a"b', "`a``b`": "a`b", '"a``b"': "a``b", "allé": "allé", "x allé": "allé", "t.日本": "日本" } for (const [item, name] of Object.entries(named)) expect(itemName(item)).toBe(name) for (const item of ["x is null", "x is not true", "case when a > 0 then 1 else 0 end", "sum(x) over w", "a and b", "a + b", - "a div b", "a mod b", "a xor b", "x between a and b", "interval '' day", "interval 1 day", "interval 1.5 hour", `x collate "C"`, "amount::numeric"]) + "a div b", "a mod b", "a xor b", "x between a and b", "interval '' day", "interval 1 day", "interval 1.5 hour", "interval '' days", + "interval '' minute", `x collate "C"`, "amount::numeric"]) expect(itemName(item)).toBeNull() }) @@ -1378,7 +1383,8 @@ describe("both tools: names at the edges", () => { ["-(amount)::numeric", null], ["(amount)::numeric * 2", null], ["(amount + 1)::int", null], ["amount::numeric + 1", null], ["cast(amount as int) * 2", null], ["amount::text || ''", null], ["cast(amount as int) between 1 and 2", null], ["amount::numeric is not null", null], ["amount::int in (1, 2)", null], ["amount::numeric as _col_1", null], - ["amount::timestamp at time zone ''", null], ["amount::text collate \"C\"", null], ["arr[1]::int", null], ["cast(amount)", null], + ["amount::timestamp at time zone ''", null], ["amount::text collate \"C\"", "amount"], ['amount collate "C"', "amount"], ["(amount)::text collate pg_catalog.default", "amount"], + ["amount::text collate", null], ["1::text collate \"C\"", null], ["arr[1]::int", null], ["cast(amount)", null], ["cast(amount as)", null], ["amount::", null], ["(amount", null], ] @@ -1387,6 +1393,38 @@ describe("both tools: names at the edges", () => { expect(wrong).toEqual([]) }) + test("castColumn gives nothing, rather than overflowing, for deeply nested parentheses", () => { + expect(castColumn(`${"(".repeat(50_000)}amount${")".repeat(50_000)}::int`)).toBeNull() + expect(castColumn(`${"(".repeat(20)}amount${")".repeat(20)}::int`)).toBe("amount") + }) + + test("a Postgres E'' string with an escaped quote doesn't shift the SELECT items", () => { + const path = write(nodes("postgres", [ + model("f", [], "select 1 as id, 2 as b, 3 as c", ["id", "b", "c"]), + model("r", ["f"], `select id, E'it\\'s, (b)::int, example', c::int, b as b from ${T("f")}`), + model("child", ["r"], `select * from ${T("r")}`), + ])) + expect(carried(columnAnswer(path, "f", "c"))).toEqual(expect.arrayContaining(["r.c", "child.c"])) + expect(carried(columnAnswer(path, "f", "c"))).not.toEqual(expect.arrayContaining(["r.b"])) + }) + + test("a keyword ends a SELECT list only as a whole name, in any script", () => { + expect(selectItems("select éfrom, id from t")).toEqual(["éfrom", "id"]) + expect(selectItems("select fromage, prix_é from t where x")).toEqual(["fromage", "prix_é"]) + expect(selectItems("select 日本, id from t")).toEqual(["日本", "id"]) + }) + + test("a Unicode name right after SELECT isn't read as a modifier", () => { + const path = write(nodes("postgres", [ + model("f", [], `select 2.5 as "allé"`, ["allé"]), + model("r", ["f"], `with q as (select * from ${T("f")}) select allé::numeric from q`), + model("child", ["r"], `select * from ${T("r")}`), + ])) + expect(() => columnReach(path, "r", "allé")).not.toThrow() + const lineage = dbtLineage({ manifest_path: path, model: "child" }) + expect(Object.keys((lineage.raw_lineage as any).column_dict ?? {})).toContain("allé") + }) + test("mixed and nested cast chains of a column are named after it", () => { for (const cast of ["cast(amount as numeric)::int", "cast(cast(amount as numeric) as int)", "(amount::numeric)::int"]) { const path = write(nodes("postgres", [ From f92232a712db8f7b61a91a98ac50557dcc428585 Mon Sep 17 00:00:00 2001 From: "Ralph Sto. Domingo" Date: Sun, 29 Nov 2026 20:38:40 +0800 Subject: [PATCH 2/3] fix: isnull ends an expression; a keyword check reads the whole code point MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `x isnull flag` reads the alias `flag`, as on main - `𐐨from` is one name: the code point before a keyword is read whole - castColumn unescapes quoted names through `unquoteName` Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BXxzvqLZuTJdDJ1Ku2ZMDY --- .../altimate/native/dbt/project-lineage.ts | 25 ++++++++++++------- .../test/altimate/column-answer.test.ts | 6 ++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/packages/opencode/src/altimate/native/dbt/project-lineage.ts b/packages/opencode/src/altimate/native/dbt/project-lineage.ts index f1511e8ef1..3cc7e7918f 100644 --- a/packages/opencode/src/altimate/native/dbt/project-lineage.ts +++ b/packages/opencode/src/altimate/native/dbt/project-lineage.ts @@ -128,6 +128,14 @@ function unquoteName(name: string): string { /** A name's characters, unquoted: letters and digits in any script, `_` and `$`. */ const NAME = "[\\p{L}\\p{N}_$]" +/** The character before index `i`, a whole code point even outside the BMP (`𐐨` is two UTF-16 units); "" at the start. */ +function charBefore(text: string, i: number): string { + if (i <= 0) return "" + const unit = text.charCodeAt(i - 1) + if (unit >= 0xdc00 && unit <= 0xdfff && i >= 2) return String.fromCodePoint(text.codePointAt(i - 2)!) + return text[i - 1]! +} + /** * The items of the SQL's outermost SELECT list (the first one outside parentheses, so after any WITH), split at * top-level commas, from literal- and comment-stripped SQL; [] when there is none. @@ -146,7 +154,7 @@ export function selectItems(stripped: string): string[] { if (depth !== 0) continue // A keyword is a whole name: `from` inside `éfrom` or `fromage` ends no list. const word = /^[\p{L}\p{N}_$]+/u.exec(text.slice(i))?.[0]?.toLowerCase() - const boundary = i === 0 || !/[\p{L}\p{N}_$]/u.test(text[i - 1]!) + const boundary = !/[\p{L}\p{N}_$]/u.test(charBefore(text, i)) if (start < 0) { if (boundary && word === "select") { start = i + 6 @@ -176,8 +184,11 @@ const LITERAL_WORDS = ["null", "true", "false", "end"] const wordList = (list: string[]) => new RegExp(`^(?:${list.join("|")})$`, "i") /** Words that end an expression rather than alias it. */ const ENDS_EXPRESSION = wordList(LITERAL_WORDS) -/** Words after which the next word is an operand, not an alias: the operators, and words that take one (`interval`, `at time zone`). */ -const TAKES_OPERAND = wordList([...OPERATOR_WORDS, "to", "interval", "distinct", "by", "as", "at", "zone"]) +/** + * Words after which the next word is an operand, not an alias: the operators, and words that take one (`interval`, + * `at time zone`). `isnull` and `notnull` end an expression, so the word after them is an alias (`x isnull flag`). + */ +const TAKES_OPERAND = wordList([...OPERATOR_WORDS.filter((word) => word !== "isnull" && word !== "notnull"), "to", "interval", "distinct", "by", "as", "at", "zone"]) /** Words a type name never holds: an item with one after `::` is more than a cast (`amount::numeric is not null`). */ const NOT_TYPE = wordList([...OPERATOR_WORDS, ...LITERAL_WORDS, "as", "at"]) /** An interval's fields: after a complete interval literal (`interval '1' day`) the word is part of it, not an alias. */ @@ -303,12 +314,8 @@ export function castColumn(item: string): string | null { const start = at++ while (punct(at, ".") && named(at + 1)) at += 2 const last = t[at - 1]! - // Only the token's own quote is escaped by doubling: `"a``b"` is a``b. - if (last.kind === "quoted") { - const q = last.text[0]! - return last.text.slice(1, -1).replaceAll(q + q, q).toLowerCase() - } - return at - start === 1 && ENDS_EXPRESSION.test(last.text) ? null : last.text.toLowerCase() + if (last.kind === "quoted") return unquoteName(last.text) + return at - start === 1 && ENDS_EXPRESSION.test(last.text) ? null : unquoteName(last.text) } const operand = (): string | null => { if ((punct(at, "(") || word(at, "cast")) && nesting >= CAST_NESTING) return null diff --git a/packages/opencode/test/altimate/column-answer.test.ts b/packages/opencode/test/altimate/column-answer.test.ts index 9d375ef07c..deb0f7b568 100644 --- a/packages/opencode/test/altimate/column-answer.test.ts +++ b/packages/opencode/test/altimate/column-answer.test.ts @@ -1231,7 +1231,9 @@ describe("both tools: names at the edges", () => { // An operator word after a dot is a column name; a complete interval literal can carry an alias. "t.mod id": "id", "t.div total": "total", "interval '' id": "id", "interval 1 day total": "total", // A quoted name drops its own doubled quote; Unicode names are names. - '"a""b"': 'a"b', 'x as "a""b"': 'a"b', "`a``b`": "a`b", '"a``b"': "a``b", "allé": "allé", "x allé": "allé", "t.日本": "日本" } + '"a""b"': 'a"b', 'x as "a""b"': 'a"b', "`a``b`": "a`b", '"a``b"': "a``b", "allé": "allé", "x allé": "allé", "t.日本": "日本", + // `isnull` and `notnull` end an expression: the next word is its alias. + "x isnull flag": "flag", "x notnull flag": "flag" } for (const [item, name] of Object.entries(named)) expect(itemName(item)).toBe(name) for (const item of ["x is null", "x is not true", "case when a > 0 then 1 else 0 end", "sum(x) over w", "a and b", "a + b", "a div b", "a mod b", "a xor b", "x between a and b", "interval '' day", "interval 1 day", "interval 1.5 hour", "interval '' days", @@ -1412,6 +1414,8 @@ describe("both tools: names at the edges", () => { expect(selectItems("select éfrom, id from t")).toEqual(["éfrom", "id"]) expect(selectItems("select fromage, prix_é from t where x")).toEqual(["fromage", "prix_é"]) expect(selectItems("select 日本, id from t")).toEqual(["日本", "id"]) + // A name outside the BMP is two UTF-16 units; the keyword check reads the whole code point before `from`. + expect(selectItems("select 𐐨from, id from t")).toEqual(["𐐨from", "id"]) }) test("a Unicode name right after SELECT isn't read as a modifier", () => { From f0ead4d6c72a3964985b2d2e79b692b184d978e4 Mon Sep 17 00:00:00 2001 From: "Ralph Sto. Domingo" Date: Sun, 29 Nov 2026 20:44:03 +0800 Subject: [PATCH 3/3] fix: a _N inside a Unicode name writes no alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `engineMade` checks whole names in any script, so `é_1` doesn't keep the engine's `_1` twin. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BXxzvqLZuTJdDJ1Ku2ZMDY --- .../src/altimate/native/dbt/project-lineage.ts | 3 ++- .../opencode/test/altimate/column-answer.test.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/altimate/native/dbt/project-lineage.ts b/packages/opencode/src/altimate/native/dbt/project-lineage.ts index 3cc7e7918f..9a7ffe958a 100644 --- a/packages/opencode/src/altimate/native/dbt/project-lineage.ts +++ b/packages/opencode/src/altimate/native/dbt/project-lineage.ts @@ -104,7 +104,8 @@ const COLUMNS_CALL = /(? { expect(selectItems("select 𐐨from, id from t")).toEqual(["𐐨from", "id"]) }) + test("an engine-style name inside a Unicode name (é_1) writes no _1, so the engine's twin still goes", () => { + const path = write(nodes("duckdb", [ + model("f", [], `select 1 as "é_1", 2.5 as amount`, ["é_1", "amount"]), + model("r", ["f"], `select é_1, amount * 2 from ${T("f")}`), + model("child", ["r"], `select * from ${T("r")}`), + ])) + const raw = dbtLineage({ manifest_path: path, model: "child" }).raw_lineage as any + expect(raw.error).toBeUndefined() + const listed = Object.keys(raw.column_dict ?? {}) + expect(listed).toContain("é_1") + expect(listed).not.toContain("_1") + }) + test("a Unicode name right after SELECT isn't read as a modifier", () => { const path = write(nodes("postgres", [ model("f", [], `select 2.5 as "allé"`, ["allé"]),