Skip to content

Conversation

@pyramation
Copy link
Collaborator

No description provided.

…method

- Replace parentNodeTypes=[] with new DeparserContext()
- Replace parentNodeTypes=[...context.parentNodeTypes, nodeType] with context.spawn(nodeType)
- Replace {...context, property: true} patterns with context.spawn(methodName, {property: true})
- Fix context propagation issues in IndexElem and CopyStmt methods
- Ensure proper context spawning for GIN index parameters and COPY statement WITH clauses
- All 279 test suites continue to pass with the new context system

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Change visit method to use context.spawn(nodeType) when calling node methods
- Ensures all methods receive properly contextualized calls with nodeType in parentNodeTypes
- Makes context spawning more consistent throughout the entire deparser
- All 279 test suites continue to pass with this more thorough approach

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…ntext

- Ensures RangeVar receives correct objtype context to prevent 'ONLY' keyword
- Fixes ALTER TYPE RENAME ATTRIBUTE statements
- All 279 test suites now passing

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…better readability

- Group (!context.parentNodeTypes.includes('AlterTypeStmt') && context.objtype !== 'OBJECT_TYPE') conditions
- Improves code semantics by making it clear both conditions relate to preventing ONLY keyword for ALTER TYPE operations
- Remove ternary operator from RenameStmt to maintain universal spawn() flow
- All 279 test suites passing

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…xt parameters

- Update formatWindowFrame method signature to accept DeparserContext parameter
- Update deparseOperatorName method signature to accept DeparserContext parameter
- Replace all empty context creation with passed context in both methods
- Update all call sites to pass properly spawned context instead of creating empty contexts
- Ensures consistent context propagation in helper methods that are not actual node types

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Change visit() to pass original context instead of spawning new context
- Prevents premature context spawning and gives node methods control
- All tests continue to pass (279/279 test suites)
- Helper methods already properly use passed context parameters

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…perty

- Add SqlFormatter as a property of DeparserContext with default instantiation
- Replace all this.formatter references with context.formatter throughout deparser
- Remove direct SqlFormatter import and private formatter property from Deparser class
- Update deparse() and visit() methods to create context with formatter when not provided
- Maintain modular design allowing external formatter instantiation and context passing
- Preserve existing formatting logic while improving context-aware formatting
- All 279 test suites continue to pass

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Make SqlFormatter private property on DeparserContext
- Add public methods: indent(), newline(), parens(), format(), isPretty()
- Replace all context.formatter.* references with direct context methods
- Fix CREATE TABLE constraint indentation using context.indentLevel
- UNIQUE and FOREIGN KEY constraints now properly indented relative to table structure
- Context spawning with increased indent levels for table elements
- All 279 test suites continue to pass

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
… indentLevel

- Remove explicit indentLevel increment when spawning table element contexts
- Let context.indent() method handle indentation automatically using indentLevel + 1
- UNIQUE and FOREIGN KEY constraints now properly indented relative to columns
- Constraints are visually distinct with proper logical grouping indentation
- All tests passing including CREATE TABLE pretty printing snapshots

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Replace hardcoded '  AND ' and '  OR ' spacing with context.indent() in BoolExpr
- Add proper indentLevel context spawning for GROUP BY and ORDER BY clauses
- Boolean expressions now use context-aware indentation for better logical grouping
- SELECT clause elements properly track indent levels through context spawning
- Consistent indentation management across nested statements and expressions

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
@pyramation pyramation marked this pull request as ready for review June 27, 2025 01:50
@pyramation pyramation merged commit a983e5a into main Jun 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants