pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

on_error = RESUME stops on error inside executed file

Open Speedphoenix opened this issue 6 years ago • 0 comments

Description

When having on_error = RESUME in my ~/.config/pgcli/config, executing an sql file that contains multiple queries will still halt on the first error.

For example: test.sql

SELECT 'makes an error' as '';

SELECT * FROM A;

outputs:

\i test.sql; SELECT col as "thisisfromb" FROM B;
syntax error at or near "''"
LINE 1: SELECT 'makes an error' as ''
                                   ^

+---------------+
| thisisfromb   |
|---------------|
+---------------+
SELECT 0
Time: 0.010s

Here the first first statement in test.sql creates an error, the second statement inside test.sql is ignored.
Statements after the file are still taken, but I need it to RESUME on statements inside the file too.
Is there a way to make pgcli resume on error for errors inside a script too?

My environment

OS and version information.

  • Ubuntu 18.04.3 LTS
  • Gnome 3.28.2
  • I use bash in Gnome Terminal

I installed pgcli first through pip install, but as the command was not available I then use sudo apt install pgcli which worked

CLI version.

$ pgcli -v
Version: 1.6.0

Output of pip freeze command.

$ pip freeze
asn1crypto==0.24.0
backports.csv==1.0.7
beautifulsoup4==4.6.0
chardet==3.0.4
cli-helpers==1.2.1
Click==7.0
configobj==5.0.6
cryptography==2.1.4
dnspython==1.15.0
enum34==1.1.6
gyp==0.1
html5lib==0.999999999
humanize==0.5.1
idna==2.6
ipaddress==1.0.17
keyring==10.6.0
keyrings.alt==3.0
lxml==4.2.1
mutagen==1.38
numpy==1.13.3
pdfshuffler==0.6.0
pgcli==2.1.1
pgsanity==0.2.9
pgspecial==1.11.7
prompt-toolkit==2.0.10
psutil==5.6.3
psycopg2==2.8.3
pycairo==1.16.2
pycrypto==2.6.1
pyflakes==1.6.0
Pygments==2.4.2
pygobject==3.26.1
PyPDF2==1.26.0
python-libdiscid==1.0
pyxdg==0.25
PyYAML==3.12
scour==0.36
SecretStorage==2.3.1
setproctitle==1.1.10
six==1.12.0
sqlparse==0.3.0
tabulate==0.8.5
terminaltables==3.1.0
unity-launcher-folders==14.9.4
unity-lens-photos==1.0
wcwidth==0.1.7
webencodings==0.5

Speedphoenix avatar Oct 11 '19 14:10 Speedphoenix