Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(compiler): prevent schema parse failures by ignoring psql meta commands #4082

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrewmbenton wants to merge 1 commit into main
base: main
Choose a base branch
Loading
from andrew/fix-4065

Conversation

Copy link
Collaborator

@andrewmbenton andrewmbenton commented Aug 29, 2025

This is kind of a lazy quick-and-dirty implementation that doesn't attempt to consolidate some duplicate line parsing that we do during migration removal and just sticks a func right in the package that handles file parsing for all engines, even though this line filter only applies to postgresql.

Happy to revise if there's a better place to put this.

Resolves #4065

dannykopping, ethanndickson, jwcodesjs, atombender, dennisgsmith, and gbarr reacted with heart emoji
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 🔧 golang labels Aug 29, 2025
Copy link

Can this please be merged? It's a blocking issue with Postgres 17. @kyleconroy

ethanndickson and gbarr reacted with thumbs up emoji

var lines []string
for s.Scan() {
line := s.Text()
if strings.HasPrefix(line, `\`) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little aggressive to remove all lines that begin with \. The following is valid SQL, but would be broken by this fix

SELECT E'
\x61 b c
';

I don't think pg_dump would create such a statement but hand written SQL could.

I would suggest that the fix only exclude lines starting with \restrict and \unrestrict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@kyleconroy kyleconroy Awaiting requested review from kyleconroy

1 more reviewer

@gbarr gbarr gbarr left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
size:S This PR changes 10-29 lines, ignoring generated files. 🔧 golang
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

SQLC fails for psql meta-commands like \restrict

AltStyle によって変換されたページ (->オリジナル) /