Skip to content

Commit c69dac4

Browse files
committed
fix: attempt to improve function parameter modes and TableLikeOption mapping
- Convert FUNC_PARAM_VARIADIC to FUNC_PARAM_DEFAULT in aggregate contexts - Handle negative values in TableLikeOption mapping - Maintain 234/258 test pass rate while debugging transformation issues Co-Authored-By: Dan Lynch <[email protected]>
1 parent df2730f commit c69dac4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -985,9 +985,9 @@ export class V13ToV14Transformer {
985985
'pg_collation_for', 'collation_for'
986986
];
987987

988-
if (funcname === 'substring') {
988+
if (funcname === 'substring' || funcname === 'pg_collation_for') {
989989
const isInSelectContext = context.parentNodeTypes?.some(type =>
990-
type.includes('Select') || type.includes('Target') || type.includes('Expr'));
990+
type.includes('Select') || type.includes('Target') || type.includes('Expr') || type.includes('FuncCall'));
991991
if (isInSelectContext) {
992992
return 'COERCE_SQL_SYNTAX';
993993
}
@@ -1043,13 +1043,12 @@ export class V13ToV14Transformer {
10431043

10441044
if (node.mode === "FUNC_PARAM_VARIADIC") {
10451045
if (isInAggregateContext) {
1046-
const isVariadicType = this.isVariadicParameterType(node.argType);
1047-
result.mode = isVariadicType ? "FUNC_PARAM_VARIADIC" : "FUNC_PARAM_DEFAULT";
1046+
result.mode = "FUNC_PARAM_DEFAULT";
10481047
} else {
10491048
const isVariadicType = this.isVariadicParameterType(node.argType);
10501049
result.mode = isVariadicType ? "FUNC_PARAM_VARIADIC" : "FUNC_PARAM_DEFAULT";
10511050
}
1052-
} else if (node.mode === "FUNC_PARAM_IN") {
1051+
}else if (node.mode === "FUNC_PARAM_IN") {
10531052
result.mode = "FUNC_PARAM_DEFAULT";
10541053
} else {
10551054
result.mode = node.mode;
@@ -2833,6 +2832,11 @@ export class V13ToV14Transformer {
28332832
private mapTableLikeOption(pg13Value: number): number {
28342833
// Handle specific mappings based on test failures:
28352834

2835+
// Handle negative values (bitwise NOT operations)
2836+
if (pg13Value < 0) {
2837+
return pg13Value;
2838+
}
2839+
28362840
if (pg13Value === 33) return 64; // DEFAULTS + STATISTICS combination
28372841
if (pg13Value === 17) return 32; // DEFAULTS + INDEXES combination
28382842
if (pg13Value === 6) return 12; // STATISTICS alone

0 commit comments

Comments
 (0)