Skip to content

Commit 38c866d

Browse files
authored
Upgrade to Postgres 17 and libpg_query 6.0.0 (#124)
* Bump libpg_query tag * Update sources * Remove invalid comment in testdata JSON * Update expected parse test results * Update module to v6 * Update benchmarks * Update CHANGELOG
1 parent c3a818d commit 38c866d

File tree

478 files changed

+142137
-110597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

478 files changed

+142137
-110597
lines changed

Diff for: CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44

55
* ...
66

7+
## 6.0.0 2024-11-26
8+
9+
* Upgrade to libpg_query 17-6.0.0
10+
- Updates to the Postgres 17 parser
11+
- Deparser improvements:
12+
- Add support for deparsing `JSON_TABLE`, `JSON_QUERY`, `JSON_EXISTS`, `JSON_VALUE`
13+
- Add support for deparsing `JSON`, `JSON_SCALAR`, `JSON_SERIALIZE`
14+
- Add support for deparsing `COPY ... FORCE_NULL(*)`
15+
- Add support for deparsing `ALTER COLUMN ... SET EXPRESSION AS`
16+
- Add support for deparsing `SET STATISTICS DEFAULT`
17+
- Add support for deparsing `SET ACCESS METHOD DEFAULT`
18+
- Add support for deparsing `... AT LOCAL`
19+
- Add support for deparsing `merge_action()`
20+
- Add support for deparsing `MERGE ... RETURNING`
21+
- Add support for deparsing `NOT MATCHED [ BY TARGET ]`
22+
* Add function `TestNormalizeUtility` to normalize only utility statements [(#116)](https://github.com/pganalyze/pg_query_go/pull/116)
723

824
## 5.1.0 2024-01-09
925

Diff for: Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ benchmark:
1616

1717
# --- Below only needed for releasing new versions
1818

19-
LIB_PG_QUERY_TAG = 43bad3cbcd1a70a30494b64f464c3f60579884ed
19+
LIB_PG_QUERY_TAG = 17-6.0.0
2020

2121
root_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
2222
LIB_TMPDIR = $(root_dir)/tmp

Diff for: README.md

+27-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pg_query_go [![GoDoc](https://godoc.org/github.com/pganalyze/pg_query_go/v5?status.svg)](https://godoc.org/github.com/pganalyze/pg_query_go/v5)
1+
# pg_query_go [![GoDoc](https://godoc.org/github.com/pganalyze/pg_query_go/v6?status.svg)](https://godoc.org/github.com/pganalyze/pg_query_go/v6)
22

33
Go version of https://github.com/pganalyze/pg_query
44

@@ -10,7 +10,7 @@ You can find further background to why a query's parse tree is useful here: http
1010
## Installation
1111

1212
```
13-
go get github.com/pganalyze/pg_query_go/v5@latest
13+
go get github.com/pganalyze/pg_query_go/v6@latest
1414
```
1515

1616
Due to compiling parts of PostgreSQL, the first time you build against this library it will take a bit longer.
@@ -44,7 +44,7 @@ package main
4444
import (
4545
"fmt"
4646

47-
pg_query "github.com/pganalyze/pg_query_go/v5"
47+
pg_query "github.com/pganalyze/pg_query_go/v6"
4848
)
4949

5050
func main() {
@@ -72,7 +72,7 @@ package main
7272
import (
7373
"fmt"
7474

75-
pg_query "github.com/pganalyze/pg_query_go/v5"
75+
pg_query "github.com/pganalyze/pg_query_go/v6"
7676
)
7777

7878
func main() {
@@ -98,7 +98,7 @@ package main
9898
import (
9999
"fmt"
100100

101-
pg_query "github.com/pganalyze/pg_query_go/v5"
101+
pg_query "github.com/pganalyze/pg_query_go/v6"
102102
)
103103

104104
func main() {
@@ -135,7 +135,7 @@ package main
135135
import (
136136
"fmt"
137137

138-
pg_query "github.com/pganalyze/pg_query_go/v5"
138+
pg_query "github.com/pganalyze/pg_query_go/v6"
139139
)
140140

141141
func main() {
@@ -173,27 +173,28 @@ go build -a
173173
go test -test.bench=. -test.run=XXX -test.benchtime 10s -test.benchmem -test.cpu=4
174174
goos: darwin
175175
goarch: arm64
176-
pkg: github.com/pganalyze/pg_query_go/v5
177-
BenchmarkParseSelect1-4 2945772 4234 ns/op 1104 B/op 20 allocs/op
178-
BenchmarkParseSelect2-4 798510 14618 ns/op 2896 B/op 59 allocs/op
179-
BenchmarkParseCreateTable-4 340454 33893 ns/op 8544 B/op 151 allocs/op
180-
BenchmarkParseSelect1Parallel-4 9166213 1332 ns/op 1104 B/op 20 allocs/op
181-
BenchmarkParseSelect2Parallel-4 2795493 4329 ns/op 2896 B/op 59 allocs/op
182-
BenchmarkParseCreateTableParallel-4 1000000 10325 ns/op 8544 B/op 151 allocs/op
183-
BenchmarkRawParseSelect1-4 3775879 3186 ns/op 192 B/op 5 allocs/op
184-
BenchmarkRawParseSelect2-4 1000000 10708 ns/op 352 B/op 5 allocs/op
185-
BenchmarkRawParseCreateTable-4 466368 25662 ns/op 1120 B/op 5 allocs/op
186-
BenchmarkRawParseSelect1Parallel-4 13386709 894.4 ns/op 192 B/op 5 allocs/op
187-
BenchmarkRawParseSelect2Parallel-4 4188447 2871 ns/op 352 B/op 5 allocs/op
188-
BenchmarkRawParseCreateTableParallel-4 1758555 6809 ns/op 1120 B/op 5 allocs/op
189-
BenchmarkFingerprintSelect1-4 6139764 1970 ns/op 112 B/op 4 allocs/op
190-
BenchmarkFingerprintSelect2-4 2813995 4264 ns/op 112 B/op 4 allocs/op
191-
BenchmarkFingerprintCreateTable-4 1668691 7194 ns/op 112 B/op 4 allocs/op
192-
BenchmarkNormalizeSelect1-4 10068253 1189 ns/op 72 B/op 4 allocs/op
193-
BenchmarkNormalizeSelect2-4 6039188 1981 ns/op 104 B/op 4 allocs/op
194-
BenchmarkNormalizeCreateTable-4 4560278 2636 ns/op 184 B/op 4 allocs/op
176+
pkg: github.com/pganalyze/pg_query_go/v6
177+
BenchmarkParseSelect1-4 2874156 4186 ns/op 1040 B/op 18 allocs/op
178+
BenchmarkParseSelect2-4 824781 14572 ns/op 2832 B/op 57 allocs/op
179+
BenchmarkParseCreateTable-4 351037 34591 ns/op 8480 B/op 149 allocs/op
180+
BenchmarkParseSelect1Parallel-4 9027080 1320 ns/op 1040 B/op 18 allocs/op
181+
BenchmarkParseSelect2Parallel-4 2745390 4369 ns/op 2832 B/op 57 allocs/op
182+
BenchmarkParseCreateTableParallel-4 1000000 10487 ns/op 8480 B/op 149 allocs/op
183+
BenchmarkRawParseSelect1-4 3778771 3183 ns/op 128 B/op 3 allocs/op
184+
BenchmarkRawParseSelect2-4 1000000 10985 ns/op 288 B/op 3 allocs/op
185+
BenchmarkRawParseCreateTable-4 460714 26397 ns/op 1056 B/op 3 allocs/op
186+
BenchmarkRawParseSelect1Parallel-4 13338790 902.7 ns/op 128 B/op 3 allocs/op
187+
BenchmarkRawParseSelect2Parallel-4 4060762 2956 ns/op 288 B/op 3 allocs/op
188+
BenchmarkRawParseCreateTableParallel-4 1709883 7001 ns/op 1056 B/op 3 allocs/op
189+
BenchmarkFingerprintSelect1-4 6394882 1875 ns/op 48 B/op 2 allocs/op
190+
BenchmarkFingerprintSelect2-4 2865390 4174 ns/op 48 B/op 2 allocs/op
191+
BenchmarkFingerprintCreateTable-4 1688920 7143 ns/op 48 B/op 2 allocs/op
192+
BenchmarkNormalizeSelect1-4 10604962 1133 ns/op 32 B/op 2 allocs/op
193+
BenchmarkNormalizeSelect2-4 6226136 1938 ns/op 64 B/op 2 allocs/op
194+
BenchmarkNormalizeCreateTable-4 4542387 2635 ns/op 144 B/op 2 allocs/op
195195
PASS
196-
ok github.com/pganalyze/pg_query_go/v5 257.324s
196+
ok github.com/pganalyze/pg_query_go/v6 258.376s
197+
197198
```
198199

199200
Note that allocation counts exclude the cgo portion, so they are higher than shown here.

Diff for: benchmark_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package pg_query_test
66
import (
77
"testing"
88

9-
pg_query "github.com/pganalyze/pg_query_go/v5"
10-
"github.com/pganalyze/pg_query_go/v5/parser"
9+
pg_query "github.com/pganalyze/pg_query_go/v6"
10+
"github.com/pganalyze/pg_query_go/v6/parser"
1111
)
1212

1313
// Prevent compiler optimizations by assigning all results to global variables

Diff for: fingerprint_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strconv"
1111
"testing"
1212

13-
pg_query "github.com/pganalyze/pg_query_go/v5"
13+
pg_query "github.com/pganalyze/pg_query_go/v6"
1414
)
1515

1616
type fingerprintTest struct {

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/pganalyze/pg_query_go/v5
1+
module github.com/pganalyze/pg_query_go/v6
22

33
go 1.14
44

Diff for: normalize_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"reflect"
88
"testing"
99

10-
pg_query "github.com/pganalyze/pg_query_go/v5"
11-
"github.com/pganalyze/pg_query_go/v5/parser"
10+
pg_query "github.com/pganalyze/pg_query_go/v6"
11+
"github.com/pganalyze/pg_query_go/v6/parser"
1212
)
1313

1414
var normalizeTests = []struct {

0 commit comments

Comments
 (0)