- 
                Notifications
    
You must be signed in to change notification settings  - Fork 58
 
Description
Hello folks,
I'm using PostgreSQL with the source connector without specifying the table id using to determine new data,
hoping the connector will figure that one out. The table in question has an id which is bigserial and a primary key.
org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0.
	at org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:65)
	at org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:128)
	at org.postgresql.jdbc.PgPreparedStatement.bindString(PgPreparedStatement.java:1025)
	at org.postgresql.jdbc.PgPreparedStatement.setString(PgPreparedStatement.java:349)
	at org.postgresql.jdbc.PgPreparedStatement.setString(PgPreparedStatement.java:336)
	at io.aiven.connect.jdbc.dialect.GenericDatabaseDialect.describeColumnsByQuerying(GenericDatabaseDialect.java:724)
	at io.aiven.connect.jdbc.source.TimestampIncrementingTableQuerier.findDefaultAutoIncrementingColumn(TimestampIncrementingTableQuerier.java:171)
	at io.aiven.connect.jdbc.source.TimestampIncrementingTableQuerier.createPreparedStatement(TimestampIncrementingTableQuerier.java:121)
	at io.aiven.connect.jdbc.source.TableQuerier.getOrCreatePreparedStatement(TableQuerier.java:83)
	at io.aiven.connect.jdbc.source.TimestampIncrementingTableQuerier.getOrCreatePreparedStatement(TimestampIncrementingTableQuerier.java:62)
Then I looked at the code https://github.com/aiven/aiven-kafka-connect-jdbc/blob/d449760552d476c52f378f920a2e99149a0f54ce/src/main/java/io/aiven/connect/jdbc/dialect/GenericDatabaseDialect.java#L716-L729
The confusing part is that the substitution of the table name is happening in prepared statement and as far as I know this is only done for parameters not the target of the query, which explains the out of bounds. I changed that to use the expression builder to
construct the full select without prepared statements which cleared the error, unfortunately the connector kept on re-scanning the table and resubmitting all the data for every tick.
I'm starting to wonder if anyone is using the defaults, thoughts? Thanks