[jOOQ/jOOQ#13169] Incorrect parsing of (NULL) row literal in PostgreSQL

for nested records, UDTs, etc.

This includes:

- [jOOQ/jOOQ#13174] ERROR: could not determine data type of parameter when projecting PostgreSQL UDT bind value
This commit is contained in:
Lukas Eder 2022-03-02 14:01:07 +01:00
parent 82e63eb8d4
commit 4f53a60c01
3 changed files with 12 additions and 3 deletions

View File

@ -116,7 +116,6 @@ import org.xml.sax.SAXException;
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
abstract class AbstractRecord extends AbstractStore implements Record {
private static final JooqLogger log = JooqLogger.getLogger(AbstractRecord.class);
final AbstractRow<? extends AbstractRecord> fields;
final Object[] values;

View File

@ -153,6 +153,16 @@ final class QualifiedRecordConstant<R extends QualifiedRecord<R>> extends Abstra
}
ctx.sql(')');
// [#13174] Need to cast inline UDT ROW expressions to the UDT type
switch (ctx.family()) {
case POSTGRES:
case YUGABYTEDB:
ctx.sql("::").visit(value.getQualifier());
break;
}
}
@Deprecated

View File

@ -446,8 +446,8 @@ public class PostgresUtils {
state = PG_OBJECT_QUOTED_VALUE;
}
// Consume "null"
else if ((c == 'n' || c == 'N') && (i + 4 < input.length())
// [#13169] Consume "null", if this is an array literal
else if ((c == 'n' || c == 'N') && (i + 4 < input.length() && open == '{')
&& input.substring(i, i + 4).equalsIgnoreCase("null")) {
values.add(null);
i += 3;