@@ -125,6 +125,37 @@ void canReadSingleStruct() throws Exception {
125125 }
126126 }
127127
128+ @ Test
129+ void canReadProjectedStructTypeNameInNestedStar () throws Exception {
130+ try (final RelationalResultSet resultSet = statement .executeQuery ("SELECT (*) FROM T" )) {
131+ Assertions .assertTrue (resultSet .next (), "Did not find a record!" );
132+ RelationalStruct struct = resultSet .getStruct (1 ).getStruct ("ST1" );
133+ Assertions .assertEquals ("STRUCT_1" , struct .getMetaData ().getTypeName ());
134+ }
135+ }
136+
137+ // When projecting *, the underlying struct types are lost and replaced with a generic UUID type.
138+ // This test should be replaced with the correct expected behavior once this is fixed.
139+ // When projecting (*), everything works as expected, see `canReadProjectedStructTypeNameInNestedStar`.
140+ // See https://github.com/FoundationDB/fdb-record-layer/issues/3743
141+ @ Test
142+ void cannotReadProjectedStructTypeNameInUnnestedStar () throws Exception {
143+ try (final RelationalResultSet resultSet = statement .executeQuery ("SELECT * FROM T" )) {
144+ Assertions .assertTrue (resultSet .next (), "Did not find a record!" );
145+ RelationalStruct struct = resultSet .getStruct ("ST1" );
146+ Assertions .assertNotEquals ("STRUCT_1" , struct .getMetaData ().getTypeName ());
147+ }
148+ }
149+
150+ @ Test
151+ void canReadProjectedStructTypeNameDirectlyProjected () throws Exception {
152+ try (final RelationalResultSet resultSet = statement .executeQuery ("SELECT ST1 FROM T" )) {
153+ Assertions .assertTrue (resultSet .next (), "Did not find a record!" );
154+ RelationalStruct struct = resultSet .getStruct ("ST1" );
155+ Assertions .assertEquals ("STRUCT_1" , struct .getMetaData ().getTypeName ());
156+ }
157+ }
158+
128159 @ Test
129160 void errorAccessingNonExistentColumn () throws Exception {
130161 try (final RelationalResultSet resultSet = statement .executeGet ("T" , new KeySet ().setKeyColumn ("NAME" , "test_record_1" ), Options .NONE )) {
0 commit comments