-
Notifications
You must be signed in to change notification settings - Fork 37.7k
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
Incorrect named parameter parsing results in InvalidDataAccessApiUsageException: No value supplied for the SQL parameter [SPR-13181] #17773
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
status: superseded
An issue that has been superseded by another
Comments
This was referenced Jan 11, 2019
Closed
Bulk closing outdated, unresolved issues. Please, reopen if still relevant. |
Still relevant |
? |
I did a quick test and didn't manage to reproduce this issue. Given that several people here claim it is relevant, please share a small test that reproduces the problem. Tests of This is the test that I used: @Test // gh-17773
public void parseSqlStatementWithPostgresArray() {
String sql = """
UPDATE ppdbbandung2015.school
SET
name=:name,
code=:code,
level=:level,
address=:address,
address_district=:address_district
address_subdistrict=:address_subdistrict
address_rw=:address_rw
address_rt=:address_rt
is_border=:is_border,
foreigner_percentage=:foreigner_percentage,
option_i=:option_i,
option=ARRAY[:option]::json[]
WHERE id=:id;""";
ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql);
assertThat(parsedSql.getParameterNames()).containsOnly(
"name", "code", "level", "address", "address_district",
"address_subdistrict", "address_rw", "address_rt",
"is_border", "foreigner_percentage", "option_i",
"option", "id");
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: data
Issues in data modules (jdbc, orm, oxm, tx)
status: superseded
An issue that has been superseded by another
Hendy Irawan opened SPR-13181 and commented
For the following SQL:
Notice that we have
ARRAY[:option]
which should be proper when executed in PostgreSQL, however Spring parses the]
after:option
as part of the parameter name, resulting in:Workaround: just add a space after the parameter name, however such special characters (e.g. "]", "{" ) should never form part of a named parameter.
Related to #17770, #17771.
Affects: 4.1.7
The text was updated successfully, but these errors were encountered: