Skip to content

Conversation

@pyramation
Copy link
Collaborator

Summary

The CreateSchemaStmt handler was not quoting the schema name, which caused parse errors when the schema name contained special characters like hyphens.

Before: CREATE SCHEMA constructive-public; (invalid SQL - hyphen interpreted as minus operator)
After: CREATE SCHEMA "constructive-public"; (valid SQL)

This fix uses QuoteUtils.quoteIdentifier() to properly quote schema names that require quoting, consistent with how other identifiers are handled elsewhere in the deparser (e.g., in sequence statements at lines 9346 and 9387).

Review & Testing Checklist for Human

  • Verify the fix doesn't break any existing functionality by running pnpm test in packages/deparser (note: there are 12 pre-existing test failures unrelated to this change)
  • Consider adding a dedicated test case for CreateSchemaStmt with special characters in schema names
  • Verify that normal schema names (e.g., public) are NOT unnecessarily quoted after this change

Test plan:

const { Deparser } = require('./packages/deparser/dist');

// Should output: CREATE SCHEMA "constructive-public";
Deparser.deparse({ stmts: [{ stmt: { CreateSchemaStmt: { schemaname: 'constructive-public' } }, stmt_len: 1 }] });

// Should output: CREATE SCHEMA public; (no quotes)
Deparser.deparse({ stmts: [{ stmt: { CreateSchemaStmt: { schemaname: 'public' } }, stmt_len: 1 }] });

Notes

The CreateSchemaStmt handler was not quoting the schema name, which
caused parse errors when the schema name contained special characters
like hyphens (e.g., 'constructive-public').

This fix uses QuoteUtils.quoteIdentifier() to properly quote schema
names that require quoting, consistent with how other identifiers
are handled elsewhere in the deparser (e.g., in sequence statements).

Before: CREATE SCHEMA constructive-public;  (invalid SQL)
After:  CREATE SCHEMA "constructive-public"; (valid SQL)
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit f3c1537 into main Jan 5, 2026
14 checks 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