-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deparse removes parentheses around CURRENT_TIMESTAMP AT TIME ZONE 'UTC' in table creation DEFAULT clause #126
Comments
My first intuition was that there would be a broader issue with complex expressions in DEFAULT value declarations. Indeed In the below test, it's only the Note that other similar cases do fail, e.g.
|
Affected library: github.com/pganalyze/pg_query_go/v6 (and likely the underlying C library)
Description:
When parsing a CREATE TABLE statement that specifies a DEFAULT value with CURRENT_TIMESTAMP at a time zone, the original query contains parentheses around the expression.
The result of
pg_query.Deparse()
on such a statement is syntactically invalid.I assume this issue is actually in regards to the C library backing the Go library, but I'm reporting it here because I'm more capable of making good test code in Go.
Steps to Reproduce:
Expected Behavior:
Parse and Deparse should be commutative, meaning that the results of Deparse should be, in turn, Parseable, e.g.:
Actual Behavior:
Deparsing removes the parentheses, producing:
If we run this through
pg_query.Parse
, we get:syntax error at or near "AT"
Environment:
Go 1.23.3
pg_query_go version: v5, v6 both tested
platform: Darwin (15.2)
Test code
The text was updated successfully, but these errors were encountered: