postgres: there is a bug while parsing a chain of union/intersect
postgres doc (18.6) state:
without parentheses,
UNION and EXCEPT associate left-to-right, but INTERSECT binds more tightly than those two
operators. Thus
query1 UNION query2 INTERSECT query3
means
query1 UNION (query2 INTERSECT query3)
from sqlglot import parse_one
select = """select 1 union select 2 intersect select 3"""
parse_one(select, dialect= "postgres")
show -> (query1 UNION query2) INTERSECT query3
instead of -> query1 UNION (query2 INTERSECT query3)
postgres: there is a bug while parsing a chain of union/intersect
postgres doc (18.6) state:
show -> (query1 UNION query2) INTERSECT query3
instead of -> query1 UNION (query2 INTERSECT query3)