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

EventuateSpringReactiveJdbcStatementExecutor doesn't handle null parameters correctly #134

Open
cer opened this issue Mar 23, 2023 · 0 comments

Comments

@cer
Copy link
Contributor

cer commented Mar 23, 2023

See eventuate-tram/eventuate-tram-sagas#97

The problem

First, reformatInsertParameters() - for Postgres replaces placeholders for null parameters with NULL:

INSERT INTO eventuate.saga_instance(saga_type, saga_id, state_name, last_request_id, saga_data_type, saga_data_json, end_state, compensating, failed) VALUES(:param1, :param2, :param3, NULL, :param5, :param6, :param7, :param8, :param9)

And then bindParameters() does this when the value is null:

        if (!(sqlDialect instanceof PostgresDialect)) {
          genericExecuteSpec = genericExecuteSpec.bindNull(i, Object.class);
        } else {
          // ??
          // skippedParameters++;
        }

This happens when i == 3, which corresponds to the 4th placeholder = :param5.

Fix:

  • Increment skippedParameters and use i - skippedParameters as the index.
cer added a commit that referenced this issue Mar 24, 2023
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