Skip to content
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

Comments not ignored with \i option, script queries not executed #1377

Open
alesbukovsky opened this issue Nov 3, 2022 · 0 comments
Open

Comments

@alesbukovsky
Copy link

alesbukovsky commented Nov 3, 2022

Description

When executing an external SQL script via the \i command, any comment line (i.e. --) causes the query(-ies) not to run. The very same script without comment works just fine. This has been introduced in version 3.5.0, I tried to downgrade to 3.4.1 and it works correctly with that version.

Version 3.5.0 show the following in the logs:

pgcli.pgexecute DEBUG - Trying a pgspecial command. sql: '--'
pgcli.pgexecute DEBUG - Regular sql statement. sql: '--'
pgcli.pgexecute DEBUG - No rows in result.
pgcli.main DEBUG - headers: None
pgcli.main DEBUG - rows: None
pgcli.main DEBUG - status: None

Version 3.4.1 goes like this:

pgcli.pgexecute DEBUG - Trying a pgspecial command. sql: "-- remove\n\nDELETE FROM users WHERE id = 1;"
pgcli.pgexecute DEBUG - Regular sql statement. sql: "-- remove\n\nDELETE FROM users WHERE id = 1;"
pgcli.pgexecute DEBUG - No rows in result.
pgcli.main DEBUG - headers: None
pgcli.main DEBUG - rows: None
pgcli.main DEBUG - status: 'DELETE 1'

Environment

MacBook Pro, macOS Monterey (12.6), pgcli installed via brew.

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

No branches or pull requests

1 participant