Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using defaults for incrementing id fails #98

Open
lyuboxa opened this issue Jul 22, 2021 · 0 comments
Open

Using defaults for incrementing id fails #98

lyuboxa opened this issue Jul 22, 2021 · 0 comments

Comments

@lyuboxa
Copy link

lyuboxa commented Jul 22, 2021

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

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

No branches or pull requests

1 participant