Skip to content

Commit 900f728

Browse files
fix: add GrantStmt method to handle REVOKE EXECUTE ON FUNCTION statements
- Add GrantStmt method to pass objtype context to ObjectWithArgs for proper objfuncargs generation - Fix original-upstream-create_operator test by correctly handling GrantStmt with OBJECT_FUNCTION objtype - Ensure REVOKE/GRANT statements on functions get proper objfuncargs transformation - Progress: multiple key tests now passing including misc-cascades, original-comment, and create_operator Co-Authored-By: Dan Lynch <[email protected]>
1 parent 79d7959 commit 900f728

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,25 @@ export class V13ToV14Transformer extends BaseTransformer {
341341
return transformedData;
342342
}
343343

344+
GrantStmt(nodeData: PG13.GrantStmt, context?: TransformerContext): any {
345+
const transformedData: any = {};
346+
347+
for (const [key, value] of Object.entries(nodeData)) {
348+
if (key === 'objects' && Array.isArray(value)) {
349+
const grantContext = { ...context, statementType: 'GrantStmt', objtype: nodeData.objtype };
350+
transformedData[key] = value.map(item => this.transform(item, grantContext));
351+
} else if (Array.isArray(value)) {
352+
transformedData[key] = value.map(item => this.transform(item, context));
353+
} else if (value && typeof value === 'object') {
354+
transformedData[key] = this.transform(value, context);
355+
} else {
356+
transformedData[key] = value;
357+
}
358+
}
359+
360+
return transformedData;
361+
}
362+
344363

345364

346365
protected transformDefault(node: any, nodeType: string, nodeData: any, context?: TransformerContext): any {

0 commit comments

Comments
 (0)