Skip to content

Commit 1a819b8

Browse files
fix: remove incorrect variadic parameter detection in createFunctionParameterFromTypeName - fixes arrays-252.sql and arrays-256.sql parameter mode issues
Co-Authored-By: Dan Lynch <[email protected]>
1 parent c0b6ef5 commit 1a819b8

File tree

1 file changed

+1
-31
lines changed

1 file changed

+1
-31
lines changed

packages/transform/src/transformers/v13-to-v14.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,12 +1046,7 @@ export class V13ToV14Transformer {
10461046
if (node.mode === "FUNC_PARAM_VARIADIC") {
10471047
result.mode = "FUNC_PARAM_VARIADIC"; // Always preserve variadic parameters
10481048
} else if (node.mode === "FUNC_PARAM_IN") {
1049-
// Check if this parameter should be variadic based on polymorphic array types
1050-
if (this.isVariadicParameterType(node.argType)) {
1051-
result.mode = "FUNC_PARAM_VARIADIC";
1052-
} else {
1053-
result.mode = "FUNC_PARAM_DEFAULT";
1054-
}
1049+
result.mode = "FUNC_PARAM_DEFAULT"; // Convert FUNC_PARAM_IN to FUNC_PARAM_DEFAULT
10551050
} else {
10561051
result.mode = node.mode;
10571052
}
@@ -2124,31 +2119,6 @@ export class V13ToV14Transformer {
21242119

21252120
let mode = "FUNC_PARAM_DEFAULT";
21262121

2127-
// Check if this is a variadic parameter type (anyarray, anycompatiblearray, etc.)
2128-
if (this.isVariadicParameterType(argType)) {
2129-
mode = "FUNC_PARAM_VARIADIC";
2130-
}
2131-
2132-
if (argType && argType.names && Array.isArray(argType.names)) {
2133-
const typeName = argType.names[argType.names.length - 1];
2134-
if (typeName && typeName.String && typeName.String.str === 'anyarray') {
2135-
mode = "FUNC_PARAM_VARIADIC";
2136-
}
2137-
}
2138-
2139-
2140-
// Also check for VARIADIC context in aggregate functions
2141-
if (context && context.parentNodeTypes) {
2142-
const isAggregateContext = context.parentNodeTypes.includes('RenameStmt') &&
2143-
(context as any).renameObjectType === 'OBJECT_AGGREGATE';
2144-
if (isAggregateContext && argType && argType.names && Array.isArray(argType.names)) {
2145-
const typeName = argType.names[argType.names.length - 1];
2146-
if (typeName && typeName.String && typeName.String.str === 'any') {
2147-
mode = "FUNC_PARAM_VARIADIC";
2148-
}
2149-
}
2150-
}
2151-
21522122
const functionParam: any = {
21532123
argType: argType,
21542124
mode: mode

0 commit comments

Comments
 (0)