Merge ConfigDb follow-ups: script FKs + ZTag/SAPID filtered unique indexes, ExternalIdReservation retired (#1040/#1049, migration ScriptForeignKeysAndExternalIdUniqueness with pre-check), SqlNamedQueryInvalid deploy rule (#1058), read-only otopcua-preflight upgrade tool (#1013/#1015/#1021)

# Conflicts:
#	docs/VirtualTags.md
This commit is contained in:
Joseph Doherty
2026-12-03 15:42:25 -05:00
56 changed files with 4623 additions and 710 deletions
+10 -4
View File
@@ -223,9 +223,11 @@ row:
`SELECT`**, with no `INTO` and no `OPENQUERY` / `OPENROWSET` / `OPENDATASOURCE` (they run text on another
server or read a file). CTEs, subqueries, window functions, `UNION`, `OPTION (…)` and `@name` parameters
are ordinary `SELECT`s and pass. An Odbc statement's positional `?` markers are read as variables for the
parse; anything else SQL Server's grammar does not accept — a PostgreSQL `::` cast, `LIMIT`, a T-SQL
reserved word used as a bare alias (`AS top`) — is refused on Odbc, so quote or rename it. The lexical
rules remain as a second, independent layer.
parse; anything else SQL Server's grammar does not accept — a PostgreSQL `::` cast of a literal or an
expression (`'a'::text`, `(v)::numeric`), `LIMIT`, `ILIKE`, a T-SQL reserved word used as a bare alias
(`AS top`) — is refused on Odbc, so quote or rename it. (`col::type` between two bare identifiers happens
to PARSE as T-SQL static-member syntax and is accepted.) The lexical rules remain as a second, independent
layer.
- **It executes in a read-only transaction where the provider has one** — always rolled back regardless:
PostgreSQL and Oracle `SET TRANSACTION READ ONLY`, MySQL a read-only **session** plus `START TRANSACTION
READ ONLY` (a smuggled `COMMIT` ends a transaction, not a session; the session is restored afterwards). A
@@ -246,7 +248,11 @@ row:
**must** connect with a `SELECT`-only login (see [Database login](#database-login-required)).
- A tag naming a query the driver config does not declare is **skipped** at Initialize (it reads
`BadNodeIdUnknown`, and `/hosts` names the missing query). One unusable `queries` entry **fails the
driver** instead, because every tag that names it would otherwise go dark unexplained.
driver** instead, because every tag that names it would otherwise go dark unexplained. Since lmxopcua#1058
the **deploy gate refuses it first** (`SqlNamedQueryInvalid`, naming the driver instance): it runs the same
`SqlNamedQueryRules.Describe` over the same merged config with the instance's provider. Before upgrading
a deployment that has Odbc drivers, run the [upgrade preflight](../v2/upgrade-preflight.md), which lists
every stored query the new guard refuses.
- Query tags read no table, so they need **no catalog gate** — a driver serving only named queries skips
the catalog load entirely. Nothing from a Query tag is ever quoted into SQL.