Skip to content

fix(drivers): keep Oracle values typed, fix Teradata ANSI transactions, complete SQL Server, Oracle and PostgreSQL DDL, and bound driver streams - #4223

Merged
datlechin merged 4 commits into
mainfrom
fix/audit-w6-sql-drivers
Nov 12, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/audit-w6-sql-drivers

Conversation

@datlechin

@datlechin datlechin commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Audit 2026-11-12, lane sql-drivers.

  • SQ-1 Oracle: import, Object Copy and query parameters write each value for its target column's type, the way a grid save does, so 00123 stays text, a date goes through a fixed mask and NVARCHAR2 text goes as UNISTR. PluginKit carries the types in PluginStatementContext.parameterTypeNames; Oracle implements the context: overloads. An untyped value keeps the PluginKit rule, with its padding-zero guard.
  • SQ-6 Oracle: table DDL and SQL export declare PRIMARY KEY, UNIQUE and CHECK constraints (SEARCH_CONDITION_VC), so the foreign keys the export adds afterwards restore. Indexes those constraints own are left out of the index phase. A NOVALIDATE constraint goes in disabled and is enabled NOVALIDATE after the rows.
  • SQ-4 SQL Server: table DDL groups foreign keys by constraint with every column, the referenced schema and both actions, keeps the real PK and UNIQUE names, CHECK constraints, computed columns, IDENTITY(seed, increment), and COLLATE where it differs from the database default. A disabled or untrusted check is switched off before the rows, and an untrusted one turned back on WITH NOCHECK after them.
  • SQ-5 SQL Server: columns read COLLATION_NAME, and ALTER COLUMN restates the collation for a character type.
  • SQ-2 Teradata: the session's real mode is read at logon when the field says DEFAULT (HELP SESSION, then DBC.SessionInfoV). ANSI sessions send no BT/ET, commit with COMMIT WORK and roll back with ROLLBACK WORK; the rollback's 3513/3514 answer counts as success. The driver reports its transaction state, so a save never commits or rolls back the editor's uncommitted work. Run All of a batch with DDL runs unwrapped (TransactionEngineFamily.teradata), and a statement failure that leaves a transaction open says so instead of "stays applied".
  • SQ-3 Teradata: a column type the decoder cannot read fails with the column's name and a CAST to use.
  • SQ-7: PostgreSQL, MySQL, SQL Server and SAP HANA streams hold at most 16 batches and the producer waits for the reader (PluginRowStream.makeBounded, deliverBlocking, deliver). Object Copy, Table Transfer and Compare lift the session query timeout around their reads, as an export does, since the source statement now lasts as long as the copy. A MySQL streaming session raises net_write_timeout to 600.
  • SQ-8 SAP HANA: an export, copy or compare that meets a large object cut at 64 MiB stops with an error; the grid keeps its warning.
  • SQ-9 MySQL: the check constraint lookup joins on CONSTRAINT_TYPE = 'CHECK'.
  • RV-2 PostgreSQL: a partitioned table's DDL writes each partition's own defaults, NOT NULLs and constraints in its PARTITION OF list, and its own indexes and comments after the partitions. A foreign table partition is written as a comment with its server and options, never created.
  • RV-3 DuckDB: a stream stopped inside an open transaction drains the statement instead of aborting the transaction.
  • Tests changed on purpose: MSSQLCreateTableStatementTests.bracketInKeyNamesIsDoubled, MSSQLSchemaQueriesTests.testAllColumnsQueryCarriesTheTableNameAfterTheParsedColumns, PostgreSQLTableDDLTests.partitionTreeOrder, ImportDataSinkAdapterBitColumnTests.anEngineThatReadsBitsAsDigitsIsNotAsked (now anEngineThatReadsBitsAsDigitsGetsNoCast).
  • PluginKit stays kit 44, additive only.
  • Docs: docs(databases): describe the SQL driver fixes from the 2026-11-12 audit docs#214

Needs the maintainer

  • Teradata ANSI: DDL the app itself runs (structure editor, rename, drop), and each DDL statement of a Run All batch, is left uncommitted, so the next statement fails with 3722 until a COMMIT. Committing after DDL there is a product call.
  • PostgreSQL foreign table partitions: the export reads their rows through the parent, so a dump that created the partition would write those rows to the remote server again. This keeps today's behaviour (not created) and says so in the DDL; the other choices are creating it, or creating a local partition in its place.

Known limits

  • SQLite streams stay unbounded: its producer runs inside the backend actor on the cooperative pool, where a blocking wait could starve it.
  • Teradata NUMBER, BLOB and CLOB columns still cannot be read: NUMBER's length byte and LOB transfer need a live server.
  • MySQL streams raise net_write_timeout to 600, so a reader stalled for 10 minutes still ends the read.
  • Not run against a live server: Teradata (mode probe, ANSI commit and rollback codes, the failure code offset), Oracle and SQL Server DDL replay, HANA cut detection.

Test plan

  • verify.sh: build, AllPlugins, the ABI check, lint, the Unit suites for the changed types, TableProCore (PluginKit, MSSQL, Teradata, DuckDB, PostgreSQL cores), TableProOracle.
  • New: PluginRowStreamDeliveryTests, BulkReadTimeoutTests, SQLStatementGeneratorParameterTypeTests, ImportDataSinkAdapterParameterTypeTests, OracleTableConstraintTests, MSSQLAlterColumnStatementTests, TeradataTransactionTests, AutocommitOnlyStatementTeradataTests, and cases in PostgreSQLTableDDLTests, MSSQLCreateTableStatementTests, MySQLCheckConstraintsTests, ObjectCopyRowCopierTests, TransactionEngineFamilyTests, BatchTransactionPolicyTests.
  • Probes by hand: MySQL 8.4.13 shows another table's check under the old join and only the table's own under the new one; the partition DDL replayed on PostgreSQL 18 into an empty database, foreign partition included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant