[destination-postgres] Syntax error at or near "CASCADE" during ensureSchemaMatches in v3.0.4
- Vorherrschende Sprache
- Python
- Sterne
- 22.1k
- Forks
- 5.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
### Connector Name
destination-postgres
### Connector Version
3.0.4
### What step the error happened?
During the sync
### Relevant information
## Description
Sync fails with "syntax error at or near CASCADE" during the `ensureSchemaMatches` phase when using Direct Load architecture. The error occurs at Position 133 in an SQL statement.
## Environment
- Airbyte Cloud
- Source: MongoDB (CDC mode)
- Destination: PostgreSQL (DigitalOcean Managed Database)
- Sync mode: CDC with deduplication
## Behavior
- The source successfully reads records from MongoDB
- The destination begins writing to PostgreSQL
- During stream finalization (`ensureSchemaMatches`), the connector generates malformed
SQL
- The sync fails with `failureType: "system_error"`
- Multiple retry attempts all fail with the same error
## Steps to reproduce
1. Configure MongoDB source with CDC enabled
2. Configure PostgreSQL destination (managed database) with v3.0.4
3. Run sync with deduplication enabled
4. Observe failure during stream finalization
## Notes
- The error is "syntax error at or near CASCADE" - this indicates malformed SQL, not a
missing CASCADE keyword
- Position 133 in the SQL statement suggests CASCADE is being inserted incorrectly
- This appears to be a bug in the Direct Load architecture introduced in v3.0.0
- DigitalOcean managed PostgreSQL does NOT restrict CASCADE operations
### Relevant log output
```shell
2025-12-09 09:17:54 info INFO i.a.i.d.p.c.PostgresAirbyteClient(execute):373 DROP TABLE
IF EXISTS "schema"."temp_table_hash" CASCADE;
2025-12-09 09:17:54 info INFO i.a.c.l.d.DestinationLifecycle(invokeSuspend):97
Finalized stream schema:config
2025-12-09 09:17:54 error ERROR main i.a.c.AirbyteConnectorRunnable(run):38 Failed
class io.airbyte.integrations.destination.postgres.cdk.WriteOperationV2 operation
execution. org.postgresql.util.PSQLException: ERROR: syntax error at or near "CASCADE"
Position: 133
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java
:2733)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2420)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:517)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:434)
at io.airbyte.integrations.destination.postgres.client.PostgresAirbyteClient.execute(Po
stgresAirbyteClient.kt:375)
at io.airbyte.integrations.destination.postgres.client.PostgresAirbyteClient.ensureSche
maMatches-Uhgc1Ac(PostgresAirbyteClient.kt:152)
at io.airbyte.cdk.load.orchestration.db.direct_load_table.DirectLoadTableDedupStreamLoa
der.close(DirectLoadTableStreamLoader.kt:112)
at io.airbyte.cdk.load.write.StreamLoader.teardown$suspendImpl(StreamLoader.kt:32)
at io.airbyte.cdk.load.dataflow.DestinationLifecycle$finalizeIndividualStreams$2$1$1.in
vokeSuspend(DestinationLifecycle.kt:96)
Sync summary: {
"status" : "failed",
"failureType" : "system_error",
"internalMessage" : "org.postgresql.util.PSQLException: ERROR: syntax error at or
near \"CASCADE\"\n Position: 133"
}
```
### Contribute
- I am unable to contribute
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.