sqlite: _texttotime best-effort parse for empty-decltype TEXT columns (#248)

#248 (closed). MAX/MIN/COALESCE over a DATETIME TEXT column drop the declared type (sqlite3_column_decltype returns "" for aggregates), so Next delivered a raw string and a Scan into *time.Time failed with unsupported Scan, storing driver.Value type string into type *time.Time.

I checked the column-metadata route the reporter suggested: on master sqlite3_column_origin_name already resolves direct columns (ColumnInfo, !113 (merged)) but returns "" through MAX/MIN/COALESCE, so it cannot recover the source type here. This does the runtime best-effort parse instead: an empty-decltype TEXT column under _texttotime is parsed via parseTime, success yields time.Time, failure falls back to the original string, so no Scan that worked before can newly fail.

Tradeoff worth your call: a plain TEXT aggregate whose value happens to look like a date (MIN(name)='2025-01-16') would parse to time.Time. That is the same ambiguity _texttotime already accepts for direct date-shaped TEXT, but flagging it since it is the reason I gated the new branch on _texttotime rather than parsing every empty-decltype TEXT column.

Two open questions:

  1. I left ColumnTypeScanType reporting string for empty decltype (it is called before any row, so it cannot know an aggregate is date-shaped), and made Next the only place that upgrades. Scan into *time.Time works regardless since it converts the delivered value, not the ScanType. Prefer that, or should ScanType also report time.Time for empty-decltype TEXT under _texttotime.
  2. The existing declared-DATE parse in Next is ungated; I gated the new aggregate parse on _texttotime. If you would rather keep them consistent (both ungated, or both gated) say which.

Draft until those are settled. rows.go Next TEXT default leg, all_test.go TestTextToTimeAggregates. gofmt clean on the changed lines; the one unrelated trailing-space gofmt nit at all_test.go:4538 is pre-existing on master and left untouched.

Merge request reports

Loading