dbcli / pgcli

Postgres CLI with autocompletion and syntax highlighting
http://pgcli.com
BSD 3-Clause "New" or "Revised" License
12.14k stars 557 forks source link

SQL error when there is a comment on the first line #1403

Closed QuentinVigand closed 1 year ago

QuentinVigand commented 1 year ago

Description

SQL error when there is a comment on the first line.

Affected version: 3.5 only (a colleague with very similar setup tried on 3.4.1 and did not reproduce). Steps to reproduce: In a file example.sql write the following:

-- 1.0.0 --
CREATE TABLE test
(
    test_name VARCHAR(255)
);

Then from the cli run \i example.sql.

OR

OUTPUT:

syntax error at end of input
LINE 1: CREATE TABLE test
                         ^
Time: 0.006s

EXPECTED OUTPUT:

CREATE TABLE
Time: 0.008s

My environment

pip freeze:

apturl==0.5.2
argcomplete==2.0.0
asn1crypto==1.4.0
asttokens==2.0.5
attrs==21.4.0
aws-lambda-powertools==1.26.1
aws-xray-sdk==2.9.0
awscli==1.22.34
Babel==2.8.0
bcrypt==3.2.0
black==22.8.0
blinker==1.4
boto3==1.24.9
botocore==1.27.9
Brlapi==0.8.3
CacheControl==0.12.11
cachy==0.3.0
certifi==2020.6.20
cffi==1.15.1
cfgv==3.3.1
chardet==4.0.0
cleo==0.8.1
cli-helpers==2.3.0
click==8.0.3
clikit==0.6.2
colorama==0.4.4
command-not-found==0.3
configobj==5.0.6
crashtest==0.3.1
cryptography==36.0.2
cupshelpers==1.0
curlify==2.2.1
dbus-python==1.2.18
defer==1.0.6
distlib==0.3.4
distro==1.7.0
distro-info===1.1build1
docker==5.0.3
docker-compose==1.29.2
dockerpty==0.4.1
docopt==0.6.2
docutils==0.17.1
duplicity==0.8.21
entrypoints==0.4
exceptiongroup==1.1.0
executing==0.8.3
fasteners==0.14.1
fastjsonschema==2.15.3
filelock==3.7.0
Flask==2.1.2
future==0.18.2
html5lib==1.1
httplib2==0.20.2
identify==2.5.3
idna==3.3
importlib-metadata==4.6.4
importlib-resources==5.10.2
iniconfig==1.1.1
itsdangerous==2.1.2
jeepney==0.7.1
Jinja2==3.0.3
jmespath==0.10.0
jsonschema==4.5.1
jupyter-core==4.10.0
kazam==1.4.5
keyring==23.5.0
language-selector==0.1
launchpadlib==1.10.16
lazr.restfulclient==0.14.4
lazr.uri==1.0.6
livereload==2.6.3
lockfile==0.12.2
louis==3.20.0
macaroonbakery==1.3.1
Mako==1.1.3
Markdown==3.3.6
MarkupSafe==2.0.1
mechanize==0.4.7
mkdocs==1.1.2
monotonic==1.6
more-itertools==8.10.0
msgpack==1.0.3
mycli==1.26.1
mypy-extensions==0.4.3
mysql-connector-python==8.0.32
mysqlclient==2.1.1
nest-asyncio==1.5.5
netifaces==0.11.0
nodeenv==1.7.0
oauthlib==3.2.0
olefile==0.46
packaging==20.9
paramiko==2.9.3
parso==0.8.3
pastel==0.2.1
pathspec==0.10.1
pendulum==2.1.2
pep517==0.8.2
pexpect==4.8.0
pgcli==3.5.0
pgspecial==2.1.0
phonenumbers==8.12.48
Pillow==9.0.1
pipx==1.0.0
pkginfo==1.8.2
platformdirs==2.5.2
pluggy==1.0.0
poetry==1.1.12
poetry-core==1.0.8
powerline-status==2.8.2
pre-commit==2.20.0
prompt-toolkit==3.0.36
protobuf==3.12.4
psutil==5.9.0
psycopg==3.1.8
ptyprocess==0.7.0
pure-eval==0.2.2
pyaes==1.6.1
pyasn1==0.4.8
pycairo==1.20.1
pycparser==2.21
pycups==2.0.1
pydantic==1.9.1
Pygments==2.11.2
PyGObject==3.42.1
pyinotify==0.9.6
PyJWT==2.3.0
pylev==1.4.0
pymacaroons==0.13.0
PyMySQL==1.0.2
PyNaCl==1.5.0
pyparsing==2.4.7
pyperclip==1.8.2
pyRFC3339==1.1
pyrsistent==0.18.1
pytest==7.2.0
python-apt==2.4.0+ubuntu1
python-dateutil==2.8.1
python-debian===0.1.43ubuntu1
python-dotenv==0.20.0
pytz==2022.1
pytzdata==2020.1
pyxdg==0.27
PyYAML==5.4.1
requests==2.25.1
requests-toolbelt==0.9.1
roman==3.3
rsa==4.8
s3transfer==0.6.0
SecretStorage==3.3.1
setproctitle==1.3.2
shellingham==1.4.0
six==1.16.0
sqlglot==10.5.6
sqlparse==0.4.3
structlog==21.5.0
systemd-python==234
tabulate==0.9.0
terminator==2.1.1
texttable==1.6.4
toml==0.10.1
tomli==2.0.1
tomlkit==0.10.2
tornado==6.1
traitlets==5.2.1.post0
typing==3.7.4.3
typing_extensions==4.2.0
ubuntu-advantage-tools==8001
ubuntu-drivers-common==0.0.0
ufw==0.36.1
unattended-upgrades==0.1
urllib3==1.26.5
usb-creator==0.3.7
userpath==1.8.0
virtualenv==20.14.1
wadllib==1.3.6
wcwidth==0.2.6
webencodings==0.5.1
websocket-client==0.59.0
Werkzeug==2.1.2
wrapt==1.14.1
xdg==5
xkit==0.0.0
yapf==0.32.0
ziglang==0.9.1
zipp==1.0.0
alesbukovsky commented 1 year ago

Looks like this is the same as #1377. Hopefully the fix applied to that one as well.