pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

Error: can't execute an empty query

Open warcayac opened this issue 3 years ago • 0 comments

Description

With the recent update of pgcli there are problems raising when running scripts containing comments at the beginning/ending of scripts.

Let's take these two scripts:

db/_scripts/01_demo_run.sql

--Chesu oliver
\i db/_scripts/01_ddl/00_demo_chesu.sql;

db/_scripts/01_ddl/00_demo_chesu.sql

--An useless comment;
select now();
-- another useless comment

When running this command from cli I get:

> \i db/_scripts/01_demo_run.sql;
syntax error at or near "\"
LINE 2: \i db/_scripts/01_ddl/00_demo_chesu.sql

If I take --Chesu oliver out and try again, I get:

> \i db/_scripts/01_demo_run.sql;
+-------------------------------+
| now                           |
|-------------------------------|
| 2022-04-30 21:35:19.783215+00 |
+-------------------------------+
SELECT 1
can't execute an empty query
Time: 0.020s

Your environment

  • [X] Please provide your OS and version information.
OS: Manjaro Linux x86_64 
Kernel: 5.17.1-3-MANJARO
  • [X] Please provide your CLI version.
3.4.1
  • [X] What is the output of pip freeze command.
$ pip freeze         
/usr/lib/python3.10/site-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 2.0.5-build-libtorrent-rasterbar-src-libtorrent-rasterbar-2.0.5-bindings-python is an invalid version and will not be supported in a future release
  warnings.warn(
anytree==2.8.0
apparmor==3.0.4
appdirs==1.4.4
asciinema==2.1.0
astroid==2.11.2
bcrypt==3.2.0
Beaker==1.11.0
breezy==3.2.1
btrfsutil==5.16.2
build==0.7.0
CacheControl==0.12.6
cairocffi==1.3.0
CairoSVG==2.5.2
ceph==1.0.0
ceph-volume==1.0.0
cephfs==2.0.0
cephfs-shell==0.0.1
certifi==2021.10.8
cffi==1.15.0
chardet==4.0.0
charset-normalizer==2.0.10
cli-helpers==2.2.1
click==8.0.3
colorama==0.4.4
configobj==5.0.6
contextlib2==0.6.0.post1
cryptography==36.0.2
cssselect2==0.5.0
cupshelpers==1.0
defusedxml==0.7.1
dill==0.3.4
distlib==0.3.4
distro==1.7.0
dnspython==2.2.0
docopt==0.6.2
dulwich==0.20.35
evdev==1.5.0
gpg==1.17.1
html5lib==1.1
httpie==2.6.0
idna==3.3
importlib-metadata==4.8.1
installer==0.5.1
isort==5.10.1
Jade-Application-Kit==3.5.6
keyutils==0.6
lazy-object-proxy==1.7.1
LibAppArmor==3.0.4
libtorrent===2.0.5-build-libtorrent-rasterbar-src-libtorrent-rasterbar-2.0.5-bindings-python
lit==13.0.1.dev0
lockfile==0.12.2
louis==3.21.0
lutris==0.5.9.1
lxml==4.8.0
Mako==1.1.6
mallard-ducktype==1.0.2
manjaro-sdk==0.1
Markdown==3.3.6
MarkupSafe==2.1.1
mccabe==0.7.0
mcomix==2.0.1
meld==3.20.4
meson==0.62.0
more-itertools==8.10.0
msgpack==1.0.3
netsnmp-python==1.0a1
nftables==0.1
npyscreen==4.10.5
ordered-set==4.0.2
packaging==20.9
pacman-mirrors==4.23.2
paramiko==2.10.3
patiencediff==0.2.2
patool==1.12
pendulum==2.1.2
pep517==0.12.0
pgcli==3.4.1
pgspecial==1.13.1
Pillow==9.1.0
platformdirs==2.5.0
ply==3.11
progress==1.6
prompt-toolkit==3.0.24
psycopg2==2.9.3
pycairo==1.21.0
pycparser==2.21
pycups==2.0.1
pycurl==7.45.1
Pygments==2.11.2
PyGObject==3.42.0
pylint==2.13.4
PyNaCl==1.5.0
pyOpenSSL==22.0.0
pyparsing==3.0.7
PyQt5==5.15.6
PyQt5-sip==12.9.1
PyQtWebEngine==5.15.5
PySide2==5.15.3
PySide6==6.2.4
pysmbc==1.0.23
PySocks==1.7.1
python-dateutil==2.8.2
pytzdata==2020.1
PyYAML==6.0
rados==2.0.0
rbd==2.0.0
reportlab==3.6.9
requests==2.27.1
requests-toolbelt==0.9.1
resolvelib==0.5.5
retrying==1.3.3
rgw==2.0.0
setproctitle==1.2.2
shiboken2==5.15.3
shiboken6==6.2.4
six==1.16.0
sqlparse==0.4.2
sshtunnel==0.4.0
systemd-python==234
tabulate==0.8.9
team==1.0
tinycss2==1.1.1
toml==0.10.2
tomli==2.0.1
torbrowser-launcher==0.3.5
typing-extensions==4.1.0
udiskie==2.4.2
ufw==0.36.1
urllib3==1.26.9
validate==5.1.0.dev0
wcwidth==0.2.5
webencodings==0.5.1
wrapt==1.14.0
xcffib==0.11.1
zipp==3.7.0

I have several scripts that ran without any problems before updating this package. How to fix this problem?

warcayac avatar Apr 30 '22 21:04 warcayac