{"record":{"id":"db4ac456444a528e","repo":"pathwaycom/pathway","slug":"column-s-collisions-collide-with-the-time-and","errorCode":null,"errorMessage":"Column(s) {collisions} collide with the 'time' and 'diff' metadata columns appended in stream_of_changes mode. Rename these columns in the Pathway table, or use output_table_type=\"snapshot\".","messagePattern":"Column\\(s\\) (.+?) collide with the 'time' and 'diff' metadata columns appended in stream_of_changes mode\\. Rename these columns in the Pathway table, or use output_table_type=\"snapshot\"\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/io/duckdb/__init__.py","lineNumber":317,"sourceCode":"            f\"({case_collisions}). DuckDB treats identifiers case-insensitively, \"\n            \"so CREATE TABLE would reject them as duplicates. Rename these columns \"\n            \"in the Pathway table so every column name is unique case-insensitively.\"\n        )\n\n    if not is_snapshot_mode:\n        # Stream-of-changes mode appends `time` / `diff` metadata columns to the\n        # destination table. If the user's own schema already has a column with\n        # one of those names, the generated CREATE TABLE would declare that column\n        # twice. Catch it here with a clear message instead of an opaque driver\n        # error at start-up.\n        reserved_metadata_columns = {\"time\", \"diff\"}\n        collisions = sorted(\n            field.name\n            for field in value_fields\n            if field.name.lower() in reserved_metadata_columns\n        )\n        if collisions:\n            raise ValueError(\n                f\"Column(s) {collisions} collide with the 'time' and 'diff' \"\n                \"metadata columns appended in stream_of_changes mode. Rename \"\n                \"these columns in the Pathway table, or use \"\n                'output_table_type=\"snapshot\".'\n            )\n\n    key_field_names: list[str] | None = None\n    if primary_key is not None:\n        # Duplicate entries in `primary_key` produce a nonsensical SQL template\n        # and reorder DELETE bindings using the duplicated index, so retractions\n        # would silently match no rows. Reject here with a clear message.\n        names_seen: set[str] = set()\n        duplicates: list[str] = []\n        for pkey in primary_key:\n            if pkey.name in names_seen and pkey.name not in duplicates:\n                duplicates.append(pkey.name)\n            names_seen.add(pkey.name)\n        if duplicates:","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/io/duckdb/__init__.py#L299-L335","documentation":"Raised by pw.io.duckdb.write in stream_of_changes mode when the table's own schema already contains a column named 'time' or 'diff' (case-insensitive). The stream mode appends time/diff metadata columns to the destination table, so the generated CREATE TABLE would declare that column twice; the connector rejects it with a clear message instead of an opaque driver error at startup.","triggerScenarios":"pw.io.duckdb.write(t, table_name=\"t\") (default stream_of_changes mode) where t has a column named time, diff, TIME, Diff, etc.","commonSituations":"Writing event/log tables that naturally carry a 'time' timestamp column or a 'diff' delta column; migrating data whose schema was designed around pathway's own output format.","solutions":["Rename the offending columns before writing, e.g. t.rename(time=\"event_time\", diff=\"delta\").","Or use output_table_type=\"snapshot\", which does not append time/diff metadata columns (requires primary_key)."],"exampleFix":"# before\n# t has columns: time, value\npw.io.duckdb.write(t, table_name=\"t\")\n\n# after\nt = t.rename(time=\"event_time\")\npw.io.duckdb.write(t, table_name=\"t\")","handlingStrategy":"validation","validationCode":"if output_table_type != \"snapshot\":\n    reserved = {\"time\", \"diff\"}\n    collisions = [c for c in table.column_names() if c.lower() in reserved]\n    assert not collisions, f\"columns colliding with time/diff: {collisions}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid naming source columns exactly 'time' or 'diff' when writing to connectors; prefer event_time/delta.","Rename defensively before writing when the source schema is external and unstable."],"tags":["duckdb","schema","reserved-names","connector"],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}