Skip to content

Commit

Permalink
Upgrade to Postgres 17 and libpg_query 6.0.0 (#124)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
msepga authored Nov 26, 2024
1 parent c3a818d commit 38c866d
Show file tree
Hide file tree
Showing 478 changed files with 142,137 additions and 110,597 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@

* ...

## 6.0.0 2024-11-26

* Upgrade to libpg_query 17-6.0.0
- Updates to the Postgres 17 parser
- Deparser improvements:
- Add support for deparsing `JSON_TABLE`, `JSON_QUERY`, `JSON_EXISTS`, `JSON_VALUE`
- Add support for deparsing `JSON`, `JSON_SCALAR`, `JSON_SERIALIZE`
- Add support for deparsing `COPY ... FORCE_NULL(*)`
- Add support for deparsing `ALTER COLUMN ... SET EXPRESSION AS`
- Add support for deparsing `SET STATISTICS DEFAULT`
- Add support for deparsing `SET ACCESS METHOD DEFAULT`
- Add support for deparsing `... AT LOCAL`
- Add support for deparsing `merge_action()`
- Add support for deparsing `MERGE ... RETURNING`
- Add support for deparsing `NOT MATCHED [ BY TARGET ]`
* Add function `TestNormalizeUtility` to normalize only utility statements [(#116)](https://github.com/pganalyze/pg_query_go/pull/116)

## 5.1.0 2024-01-09

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ benchmark:

# --- Below only needed for releasing new versions

LIB_PG_QUERY_TAG = 43bad3cbcd1a70a30494b64f464c3f60579884ed
LIB_PG_QUERY_TAG = 17-6.0.0

root_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
LIB_TMPDIR = $(root_dir)/tmp
Expand Down
53 changes: 27 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 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)
# 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)

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

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

```
go get github.com/pganalyze/pg_query_go/v5@latest
go get github.com/pganalyze/pg_query_go/v6@latest
```

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

pg_query "github.com/pganalyze/pg_query_go/v5"
pg_query "github.com/pganalyze/pg_query_go/v6"
)

func main() {
Expand Down Expand Up @@ -72,7 +72,7 @@ package main
import (
"fmt"

pg_query "github.com/pganalyze/pg_query_go/v5"
pg_query "github.com/pganalyze/pg_query_go/v6"
)

func main() {
Expand All @@ -98,7 +98,7 @@ package main
import (
"fmt"

pg_query "github.com/pganalyze/pg_query_go/v5"
pg_query "github.com/pganalyze/pg_query_go/v6"
)

func main() {
Expand Down Expand Up @@ -135,7 +135,7 @@ package main
import (
"fmt"

pg_query "github.com/pganalyze/pg_query_go/v5"
pg_query "github.com/pganalyze/pg_query_go/v6"
)

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

Note that allocation counts exclude the cgo portion, so they are higher than shown here.
Expand Down
4 changes: 2 additions & 2 deletions benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package pg_query_test
import (
"testing"

pg_query "github.com/pganalyze/pg_query_go/v5"
"github.com/pganalyze/pg_query_go/v5/parser"
pg_query "github.com/pganalyze/pg_query_go/v6"
"github.com/pganalyze/pg_query_go/v6/parser"
)

// Prevent compiler optimizations by assigning all results to global variables
Expand Down
2 changes: 1 addition & 1 deletion fingerprint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strconv"
"testing"

pg_query "github.com/pganalyze/pg_query_go/v5"
pg_query "github.com/pganalyze/pg_query_go/v6"
)

type fingerprintTest struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/pganalyze/pg_query_go/v5
module github.com/pganalyze/pg_query_go/v6

go 1.14

Expand Down
4 changes: 2 additions & 2 deletions normalize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"reflect"
"testing"

pg_query "github.com/pganalyze/pg_query_go/v5"
"github.com/pganalyze/pg_query_go/v5/parser"
pg_query "github.com/pganalyze/pg_query_go/v6"
"github.com/pganalyze/pg_query_go/v6/parser"
)

var normalizeTests = []struct {
Expand Down
Loading

0 comments on commit 38c866d

Please sign in to comment.