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

fix: return correct base type for domain from getUDTs (#2520) #2522

Merged
merged 1 commit into from May 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -2696,7 +2696,7 @@ public ResultSet getUDTs(@Nullable String catalog, @Nullable String schemaPatter
long longTypOid = typeInfo.intOidToLong(typOid);
int sqlType = typeInfo.getSQLType(typOid);

sqlwhen.append(" when t.oid = ").append(longTypOid).append(" then ").append(sqlType);
sqlwhen.append(" when oid = ").append(longTypOid).append(" then ").append(sqlType);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use an alias for oid=.. condition?
The current syntax is obscure in the sense that the source of oid column is hard to tell.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that idea. Making the intent clear is inexpensive

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlsi, sorry just saw your suggestion.
I can add the alias and submit another PR.

}
sql += sqlwhen.toString();

Expand Down
Expand Up @@ -1188,7 +1188,7 @@ public void testGetUDT1() throws Exception {
String remarks = rs.getString("remarks");

int baseType = rs.getInt("base_type");
assertTrue("base type", !rs.wasNull());
assertEquals("base type", java.sql.Types.BIGINT, baseType);
assertEquals("data type", Types.DISTINCT, dataType);
assertEquals("type name ", "testint8", typeName);
assertEquals("remarks", "jdbc123", remarks);
Expand Down Expand Up @@ -1220,7 +1220,7 @@ public void testGetUDT2() throws Exception {
String remarks = rs.getString("remarks");

int baseType = rs.getInt("base_type");
assertTrue("base type", !rs.wasNull());
assertEquals("base type", java.sql.Types.BIGINT, baseType);
assertEquals("data type", Types.DISTINCT, dataType);
assertEquals("type name ", "testint8", typeName);
assertEquals("remarks", "jdbc123", remarks);
Expand Down Expand Up @@ -1251,7 +1251,7 @@ public void testGetUDT3() throws Exception {
String remarks = rs.getString("remarks");

int baseType = rs.getInt("base_type");
assertTrue("base type", !rs.wasNull());
assertEquals("base type", java.sql.Types.BIGINT, baseType);
assertEquals("data type", Types.DISTINCT, dataType);
assertEquals("type name ", "testint8", typeName);
assertEquals("remarks", "jdbc123", remarks);
Expand Down