You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the issue
When invoking the getUDTs method of PgDatabaseMetaData for a user-defined (aka domain) type, an incorrect value of Types.OTHER is returned instead of the corresponding data type of the base data type.
Driver Version?
Change in behavior was introduced in 42.2.23
The change was this commit: e1b8437
which is a backport of this commit: 375cb37
Java Version?
n/a
OS Version?
n/a
PostgreSQL Version?
n/a
To Reproduce
Below is a small program that demonstrates the issue.
Prior to the driver upgrade (we were on 42.2.16) the expected type Types.VARCHAR was returned, and after the upgrade (to 42.2.25), Types.OTHER started to be returned.
import java.sql.*;
public class test1 {
public static void main(String[] args) throws Exception
{
String url = "jdbc:postgresql://localhost:5432/postgres?user=host_user";
Connection con = DriverManager.getConnection(url);
Statement stmt = con.createStatement();
stmt.execute("create domain mytype1 as text");
ResultSet rs = con.getMetaData().getUDTs(null, null, "mytype1", null);
rs.next();
int bt = rs.getInt("base_type");
if (bt != java.sql.Types.VARCHAR)
System.out.println("Unexpected base type: " + rs.getInt("base_type"));
stmt.execute("drop domain mytype1");
con.close();
}
}
// Output with driver 42.2.16:
// Output with driver 42.2.25: Unexpected base type: 1111
Expected behaviour
It is expected that the data type of the base type of the domain is returned back in the base_type column of the result set from getUDTs method. Instead, Types.OTHER is being returned.
Logs
n/a
The text was updated successfully, but these errors were encountered:
I have the fix for this issue, but I was not able to create a new branch (not authorized) for the PR.
Please let me know if I'm missing some steps or not following the correct process.
Essentially the issue is that there it a typo in the generated SQL that uses t.oid instead of the oid, because we want to reference the base type oid in that CASE statement.
I've also changed the corresponding test cases to test for the base type (previously it was merely testing whether base type was null or not).
Please read https://stackoverflow.com/help/minimal-reproducible-example
Describe the issue
When invoking the
getUDTs
method ofPgDatabaseMetaData
for a user-defined (aka domain) type, an incorrect value ofTypes.OTHER
is returned instead of the corresponding data type of the base data type.Driver Version?
Change in behavior was introduced in
42.2.23
The change was this commit: e1b8437
which is a backport of this commit: 375cb37
Java Version?
n/a
OS Version?
n/a
PostgreSQL Version?
n/a
To Reproduce
Below is a small program that demonstrates the issue.
Prior to the driver upgrade (we were on 42.2.16) the expected type
Types.VARCHAR
was returned, and after the upgrade (to 42.2.25),Types.OTHER
started to be returned.Expected behaviour
It is expected that the data type of the base type of the domain is returned back in the
base_type
column of the result set fromgetUDTs
method. Instead, Types.OTHER is being returned.Logs
n/a
The text was updated successfully, but these errors were encountered: