The AbstractDatabaseMetaData.getPrimaryKeys uses the AbstractDatabaseMetaData.Clause class for querying the primary keys.
However, this Clause class checks whether the provided pattern contains wildcards.
For tables with names like "AB_DE" this is true thus a like query is executed.
If there are two tables
and getPrimaryKeys(null, null, "AB_DE") is called this returns also the primary keys of ABCDE.
A further problem is that a String right truncation error is thrown if the table name is 31 characters long and contains an underscore
The check for wildcards is not necessary in the case of getPrimaryKeys, since the exact table name is given