pganalyze / pg_query_go

Go library to parse and normalize SQL queries using the PostgreSQL query parser
BSD 3-Clause "New" or "Revised" License
663 stars 79 forks source link

Has an issue with the parser package after update to MacOS 13 #66

Closed TruongNguyenLava closed 2 years ago

TruongNguyenLava commented 2 years ago

System: Machine: Macbook Pro M1 Go version: 1.19.3 OS: MacOS 13 pg_query_go: 1.0.3

Summary I don't understand why there is an error from XCode, maybe this error is related to MacOS 13. I have googled to try to solve this but no success, do you have any ideas?

image

ulfmagnetics commented 2 years ago

The underlying issue appears to be a conflict between clang v14.0.0 and the sqlc module -- see this issue. I was able to work around it by installing the Command Line Tools for XCode 13.4 from here, though I'm still on Monterey and I'm not sure if this will still work for Ventura.

TruongNguyenLava commented 2 years ago

Thank you @ulfmagnetics, but I can't install Command Line Tools for XCode 13.4 on MacOS 13.

image

lfittl commented 2 years ago

@TruongNguyenLava This might be the same issue that was fixed in version 2.2.0 (see https://github.com/pganalyze/pg_query_go/pull/64 and https://github.com/pganalyze/libpg_query/pull/156)

Are you seeing this with sqlc, or something else? (I've opened up a PR on sqlc to get the library dependency updated: https://github.com/kyleconroy/sqlc/pull/1921)

TruongNguyenLava commented 2 years ago

Thanks @lfittl everything works perfectly in 2.2.0

funny-falcon commented 2 years ago

The problem is in bison: native MacOS bison is very old (2.2). It defines a lot of garbage macroses before include directives.

Instalation of bison 3.8.2 with brew fixed compilation.