You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to parse some sql statements I have run into this issue parsing a create statement, others so far are happy, but parsing gen_random_uuid() I get a ParseError for a missing ). The offending query runs in postgres.
Traceback (most recent call last):
File "/x.py", line 10, in <module>
sqlglot.parse_one(stmt, read="postgres", dialect="postgres")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/__init__.py", line 136, in parse_one
result = dialect.parse(sql, **opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/dialects/dialect.py", line 690, in parse
return self.parser(**opts).parse(self.tokenize(sql), sql)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1287, in parse
return self._parse(
^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1356, in _parse
expressions.append(parse_method(self))
^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1585, in _parse_statement
return self.STATEMENT_PARSERS[self._prev.token_type](self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 696, in <lambda>
TokenType.CREATE: lambda self: self._parse_create(),
^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1727, in _parse_create
this = self._parse_schema(this=table_parts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 4949, in _parse_schema
self._match_r_paren()
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 6665, in _match_r_paren
self.raise_error("Expecting )")
File "/.venv/lib/python3.12/site-packages/sqlglot/parser.py", line 1400, in raise_error
raise error
sqlglot.errors.ParseError: Expecting ). Line 4, Col: 55.
(
id BIGSERIAL PRIMARY KEY NOT NULL,
user_id uuid UNIQUE DEFAULT gen_random_uuid()
);
The text was updated successfully, but these errors were encountered:
Attempting to parse some sql statements I have run into this issue parsing a create statement, others so far are happy, but parsing
gen_random_uuid()
I get a ParseError for a missing)
. The offending query runs in postgres.Minimal script to reproduce
Stacktrace
The text was updated successfully, but these errors were encountered: