Skip to content

Commit 8de72df

Browse files
debug: add detailed objargs logging to investigate operator argument parsing
Co-Authored-By: Dan Lynch <[email protected]>
1 parent 7607241 commit 8de72df

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,19 +1721,46 @@ export class V13ToV14Transformer {
17211721
const shouldPreserveObjfuncargs = this.shouldPreserveObjfuncargs(context);
17221722
const shouldCreateObjfuncargsFromObjargs = this.shouldCreateObjfuncargsFromObjargs(context);
17231723

1724+
17241725
if (shouldCreateObjfuncargsFromObjargs && result.objargs) {
17251726
// Create objfuncargs from objargs (this takes priority over shouldCreateObjfuncargs)
1727+
if (context.parentNodeTypes && context.parentNodeTypes.includes('AlterOwnerStmt')) {
1728+
console.log('DEBUG: Processing objargs for AlterOwnerStmt:', {
1729+
objargs: result.objargs,
1730+
isArray: Array.isArray(result.objargs),
1731+
length: Array.isArray(result.objargs) ? result.objargs.length : 'not array'
1732+
});
1733+
}
1734+
17261735
result.objfuncargs = Array.isArray(result.objargs)
17271736
? result.objargs.map((arg: any) => this.createFunctionParameterFromTypeName(arg))
17281737
: [this.createFunctionParameterFromTypeName(result.objargs)];
1738+
1739+
if (context.parentNodeTypes && context.parentNodeTypes.includes('AlterOwnerStmt')) {
1740+
console.log('DEBUG: Created objfuncargs for AlterOwnerStmt:', {
1741+
objfuncargs: result.objfuncargs,
1742+
objfuncargsLength: result.objfuncargs.length,
1743+
shouldPreserveObjfuncargs,
1744+
willCheckPreserve: true
1745+
});
1746+
}
17291747
} else if (shouldCreateObjfuncargs) {
17301748
result.objfuncargs = [];
17311749
} else if (result.objfuncargs !== undefined) {
1750+
if (context.parentNodeTypes && context.parentNodeTypes.includes('AlterOwnerStmt')) {
1751+
console.log('DEBUG: Checking preserve for existing objfuncargs:', {
1752+
shouldPreserveObjfuncargs,
1753+
willDelete: !shouldPreserveObjfuncargs
1754+
});
1755+
}
17321756
if (shouldPreserveObjfuncargs) {
17331757
result.objfuncargs = Array.isArray(result.objfuncargs)
17341758
? result.objfuncargs.map((item: any) => this.transform(item, context))
17351759
: [this.transform(result.objfuncargs, context)];
17361760
} else {
1761+
if (context.parentNodeTypes && context.parentNodeTypes.includes('AlterOwnerStmt')) {
1762+
console.log('DEBUG: DELETING objfuncargs because shouldPreserveObjfuncargs is false');
1763+
}
17371764
delete result.objfuncargs;
17381765
}
17391766
} else if (!shouldPreserveObjfuncargs) {
@@ -1819,6 +1846,18 @@ export class V13ToV14Transformer {
18191846
return false;
18201847
}
18211848

1849+
if (context.parentNodeTypes.includes('AlterOwnerStmt')) {
1850+
const path = context.path || [];
1851+
for (const node of path) {
1852+
if (node && typeof node === 'object' && 'AlterOwnerStmt' in node) {
1853+
const alterOwnerStmt = node.AlterOwnerStmt;
1854+
if (alterOwnerStmt && alterOwnerStmt.objectType === 'OBJECT_OPERATOR') {
1855+
return true;
1856+
}
1857+
}
1858+
}
1859+
}
1860+
18221861
const path = context.path || [];
18231862
const excludedNodeTypes = [
18241863
'CreateOpClassStmt', 'CreateAggregateStmt', 'AlterAggregateStmt',

0 commit comments

Comments
 (0)