pgcli
pgcli copied to clipboard
Comments not ignored with \i option, script queries not executed
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.