MCPcopy Create free account
hub / github.com/bytebase/bytebase / isCTERef

Function isCTERef

backend/plugin/parser/tidb/backup.go:423–425  ·  view source on GitHub ↗

isCTERef reports whether ref resolves to a CTE. A CTE reference is always unqualified, so a schema-qualified physical table (db.test) is never a CTE even if its name matches one. CTE names match case-insensitively (TiDB resolves a case-mismatched reference to the CTE, which shadows a same-named real

(cteNames map[string]bool, ref *TableReference)

Source from the content-addressed store, hash-verified

421// resolves a case-mismatched reference to the CTE, which shadows a same-named
422// real table), consistent with the file's other identifier comparisons.
423func isCTERef(cteNames map[string]bool, ref *TableReference) bool {
424 return !ref.ExplicitSchema && cteNames[strings.ToLower(ref.Table)]
425}
426
427// writeCTEPrefix writes the statement's WITH (CTE) clause before the backup
428// SELECT, so a SELECT whose FROM references a CTE stays valid. omni does not

Callers 3

extractTablesFromDeleteFunction · 0.85
extractTablesFromUpdateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected