Skip to content

Conversation

@pyramation
Copy link
Collaborator

No description provided.

- Add isPgCatalogType helper method to detect pg_catalog types and aliases
- Modify TypeCast method to use :: syntax for pg_catalog types
- Preserve CAST() syntax for qualified bpchar types to maintain AST consistency
- Update test cases and snapshots for castings and pg-catalog tests
- All 267 test suites pass including kitchen-sink tests

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Allow FuncCall node types to use :: syntax when casting to pg_catalog types
- Successfully converts CAST(public.gen_random_uuid() AS text) to public.gen_random_uuid()::text
- Updated pg-catalog test snapshot to reflect new behavior
- All 267 test suites pass with no regressions

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- SELECT statements: single targets inline, multiple targets multiline
- CREATE TRIGGER statements: each component on separate lines with indentation
- ALTER DEFAULT PRIVILEGES statements: GRANT clause on new line with indentation
- Updated test snapshots to reflect correct formatting behavior
- All formatting rules only apply when isPretty() is true
- Maintains backward compatibility with existing non-pretty formatting

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Implement isComplexSelectTarget method for nuanced complexity detection
- Single simple targets: render inline (e.g. SELECT 1;, SELECT name;)
- Single complex targets: render multiline (e.g. CASE, COALESCE with multiple args)
- Multiple targets: always render multiline regardless of complexity
- Complex expressions include: CASE, subqueries, functions with multiple args/clauses
- Simple expressions include: literals, column refs, simple arithmetic, basic function calls
- All formatting rules only apply when isPretty() is true
- Maintains backward compatibility and passes all existing tests

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Replace hardcoded quote wrapping with QuoteUtils.quote() in CreatePolicyStmt and AlterPolicyStmt methods
- Policy names like 'user_policy', 'admin_policy', 'simple_policy' are now correctly unquoted
- Policy names with spaces or special characters (e.g. 'Simple Policy') are still properly quoted
- Updated test snapshots to reflect correct quoting behavior
- All 269 test suites pass with 380 tests passing

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Set isStringLiteral context for trigger function arguments in CreateTrigStmt
- Ensures string literals are properly quoted with single quotes via QuoteUtils.formatEString()
- Prevents automatic lowercase conversion during parse/deparse cycle
- Fixes triggers-9.sql test where 'TYPE_A' was being converted to 'type_a'
- Updated snapshots to reflect correct string literal formatting

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Place ADD CONSTRAINT on new line with indentation when pretty printing enabled
- Maintains existing behavior for non-pretty mode
- Follows existing pretty printing patterns in codebase
- Updated constraint test snapshots to reflect new formatting

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Place FOREIGN KEY and REFERENCES clauses on separate lines with indentation
- Improve CHECK constraint formatting for multi-line expressions with proper parentheses
- Fix MATCH clause spacing to prevent 'REFERENCESfooMATCH FULL' parsing errors
- Add proper indentation for NOT VALID clause in pretty printing mode
- Maintain existing behavior for non-pretty mode
- Follow existing pretty printing patterns in codebase

Fixes kitchen-sink test failures in:
- original-tables-custom.test.ts
- original-upstream-foreign_key.test.ts
- original-upstream-alter_table.test.ts

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Place FOREIGN KEY clause on new line after ADD CONSTRAINT in ALTER TABLE
- Add proper line breaks for UNIQUE and CHECK constraints in CREATE TABLE
- Maintain existing behavior for column constraints and non-pretty mode
- Follow existing pretty printing patterns with newline() and indent()
- Update all affected test snapshots to reflect correct formatting

Fixes constraint formatting issues where table-level constraints were
appearing inline instead of on separate lines when pretty printing
is enabled.

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Add indentLevel property to DeparserContext interface for better indentation tracking
- Fix BoolExpr formatting to use consistent 2-space indentation for AND/OR operators
- Remove extra blank lines in CREATE TABLE constraint formatting
- Improve CHECK constraint formatting with proper line breaks and indentation
- Fix constraints-17.sql, constraints-16.sql, and constraints-9.sql formatting issues
- Update test snapshots to reflect improved constraint formatting
- Maintain backward compatibility for non-pretty printing modes

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
- Align closing parenthesis with CHECK keyword at same indentation level
- Fixes constraints-16.sql formatting where closing paren was over-indented
- Maintains existing functionality for other constraint types
- All constraint formatting tests pass

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
@pyramation pyramation marked this pull request as ready for review June 26, 2025 07:59
- Fix VALUES formatting to avoid corrupting string literals with escape sequences
- Use containsMultilineStringLiteral() to preserve original string content
- Column lists always wrapped in parentheses across multiple lines
- VALUES keyword always on its own line
- Each tuple indented by two spaces
- Preserve quoted identifiers and schema names exactly
- Update casing-pretty.test.ts snapshots with new formatting rules

Co-Authored-By: Dan Lynch <pyramation@gmail.com>
@pyramation pyramation merged commit 8fe072a into main Jun 26, 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