psqlparse icon indicating copy to clipboard operation
psqlparse copied to clipboard

parse errors when parse create table statement

Open chuxiangfeng opened this issue 3 years ago • 1 comments

it can not parse Postgres create table sql , with partition by, example: sql = """create table aaa ( id integer default nextval('aaa_id_seq'::regclass) not null, name varchar ) partition by RANGE (name)""" print(psqlparse.parse(sql))

throw an exception as:

Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1491, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/chuxiangfeng/PycharmProjects/pythonEffectiveS/tools/sqlparse.py", line 14, in print(psqlparse.parse(sql)) File "psqlparse/parser.pyx", line 28, in psqlparse.parser.parse (psqlparse/parser.c:1042) psqlparse.exceptions.PSqlParseError: syntax error at or near "partition"

chuxiangfeng avatar Sep 15 '22 07:09 chuxiangfeng

The version of the library is likely too old for it.

I no longer maintain this package, but I'm willing to transfer the maintainer role.

alculquicondor avatar Sep 15 '22 13:09 alculquicondor