Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sqlglot/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,7 @@ def _parse_comment(self, allow_exists: bool = True) -> exp.Expr:
elif kind.token_type == TokenType.COLUMN:
this = self._parse_column()
else:
this = self._parse_id_var()
this = self._parse_table_parts(schema=True)

self._match(TokenType.IS)

Expand Down
6 changes: 6 additions & 0 deletions tests/dialects/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def test_postgres(self):
self.validate_identity("SELECT CASE WHEN SUBSTRING('abcdefg') IN ('ab') THEN 1 ELSE 0 END")
self.validate_identity("COMMENT ON TABLE mytable IS 'this'")
self.validate_identity("COMMENT ON MATERIALIZED VIEW my_view IS 'this'")
self.validate_identity("COMMENT ON TYPE mood IS 'x'")
self.validate_identity("COMMENT ON TYPE foo.mood IS 'x'")
self.validate_identity("COMMENT ON VIEW foo.bat IS 'x'")
self.validate_identity("COMMENT ON MATERIALIZED VIEW foo.my_view IS 'x'")
self.validate_identity("COMMENT ON SEQUENCE public.seq IS 'x'")
self.validate_identity("COMMENT ON INDEX public.idx IS 'x'")
self.validate_identity("SELECT e'\\xDEADBEEF'")
self.validate_identity("SELECT CAST(e'\\176' AS BYTEA)")
self.validate_identity("SELECT * FROM x WHERE SUBSTRING('Thomas' FROM '...$') IN ('mas')")
Expand Down
Loading