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

Connection.getMetaData().getProcedures does not handle schema as a pattern #2336

Closed
snicoll opened this issue Feb 21, 2024 · 5 comments · Fixed by #2369
Closed

Connection.getMetaData().getProcedures does not handle schema as a pattern #2336

snicoll opened this issue Feb 21, 2024 · 5 comments · Fixed by #2369
Milestone

Comments

@snicoll
Copy link

snicoll commented Feb 21, 2024

Driver version

12.6.0.jre11

SQL Server version

2017-latest

Client Operating System

MacOS

JAVA/JVM version

openjdk version "17.0.10" 2024-01-16 LTS

Table schema

A full repro is available here:
https://github.com/ks-no/spring-jdbc-demo

Problem description

The Javadoc of java.sql.DatabaseMetaData#getProcedures states that the schema and procedureName parameters are pattern and not exact match, just like its sibbling getFunctions.

Looking at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData, those parameters seem to be handled as patterns using the escapeIDName method. However the sames arguments for getProcedures are not.

Expected behavior

Searching for a procedure using some\_schema should search for exactly some_schema (and not any character between some and schema).

Actual behavior

If the pattern character is escaped using the escape character, the search does not succeed.

See also spring-projects/spring-framework#32295

@tkyc
Copy link
Member

tkyc commented Feb 21, 2024

Thanks for the repro taking a look. I'll get back to you.

@snicoll
Copy link
Author

snicoll commented Feb 22, 2024

The repro is from a third party with a weird test. Let me know if you're having trouble running it (like I did) and I can provide something more straightforward.

@audunmeltzer
Copy link

If you run test from intellij, you need this plugin: https://plugins.jetbrains.com/plugin/14080-kotest

@tkyc
Copy link
Member

tkyc commented Feb 22, 2024

@snicoll

The repro is from a third party with a weird test. Let me know if you're having trouble running it (like I did) and I can provide something more straightforward.

Thanks, if you can share that as well.

@tkyc
Copy link
Member

tkyc commented Feb 23, 2024

Using escapeIDName seems to fix the issue. Still testing/evaluating the fix...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed Issues
4 participants