Skip to content

Commit

Permalink
Release 5.0.0 (v5), add Postgres 16 support (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
lfittl committed Dec 23, 2023
1 parent 7463430 commit 1896d12
Show file tree
Hide file tree
Showing 488 changed files with 243,237 additions and 198,904 deletions.
4 changes: 2 additions & 2 deletions 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 = 15-4.2.3
LIB_PG_QUERY_TAG = 16-5.0.0

root_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
LIB_TMPDIR = $(root_dir)/tmp
Expand All @@ -41,7 +41,7 @@ update_source: $(LIBDIR)
rmdir parser/postgres
cp -a $(LIBDIR)/pg_query.h parser/include
# Make sure every .c in the top-level directory is its own translation unit
mv parser/*{_conds,_defs,_helper}.c parser/include
mv parser/*{_conds,_defs,_helper,.funcs}.c parser/include
# Protobuf definitions
mkdir -p $(PWD)/bin
GOBIN=$(PWD)/bin go install google.golang.org/protobuf/cmd/protoc-gen-go
Expand Down
52 changes: 26 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/v4?status.svg)](https://godoc.org/github.com/pganalyze/pg_query_go/v4)
# 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)

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/v4@latest
go get github.com/pganalyze/pg_query_go/v5@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/v4"
pg_query "github.com/pganalyze/pg_query_go/v5"
)

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

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

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

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

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

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

func main() {
Expand Down Expand Up @@ -173,27 +173,27 @@ 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/v4
BenchmarkParseSelect1-4 3230398 3656 ns/op 1104 B/op 20 allocs/op
BenchmarkParseSelect2-4 927363 12739 ns/op 2896 B/op 59 allocs/op
BenchmarkParseCreateTable-4 399819 30080 ns/op 8432 B/op 151 allocs/op
BenchmarkParseSelect1Parallel-4 10951803 1094 ns/op 1104 B/op 20 allocs/op
BenchmarkParseSelect2Parallel-4 3255471 3675 ns/op 2896 B/op 59 allocs/op
BenchmarkParseCreateTableParallel-4 1341716 8919 ns/op 8432 B/op 151 allocs/op
BenchmarkRawParseSelect1-4 4275111 2795 ns/op 192 B/op 5 allocs/op
BenchmarkRawParseSelect2-4 1252704 9534 ns/op 352 B/op 5 allocs/op
BenchmarkRawParseCreateTable-4 503385 23168 ns/op 1120 B/op 5 allocs/op
BenchmarkRawParseSelect1Parallel-4 15446528 780.1 ns/op 192 B/op 5 allocs/op
BenchmarkRawParseSelect2Parallel-4 4638837 2595 ns/op 352 B/op 5 allocs/op
BenchmarkRawParseCreateTableParallel-4 1932316 6197 ns/op 1120 B/op 5 allocs/op
BenchmarkFingerprintSelect1-4 6583965 1795 ns/op 112 B/op 4 allocs/op
BenchmarkFingerprintSelect2-4 2962663 4015 ns/op 112 B/op 4 allocs/op
BenchmarkFingerprintCreateTable-4 1796041 6831 ns/op 112 B/op 4 allocs/op
BenchmarkNormalizeSelect1-4 10073278 1171 ns/op 72 B/op 4 allocs/op
BenchmarkNormalizeSelect2-4 6029834 1932 ns/op 104 B/op 4 allocs/op
BenchmarkNormalizeCreateTable-4 4703816 2490 ns/op 184 B/op 4 allocs/op
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
PASS
ok github.com/pganalyze/pg_query_go/v4 273.449s
ok github.com/pganalyze/pg_query_go/v5 257.324s
```

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/v4"
"github.com/pganalyze/pg_query_go/v4/parser"
pg_query "github.com/pganalyze/pg_query_go/v5"
"github.com/pganalyze/pg_query_go/v5/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/v4"
pg_query "github.com/pganalyze/pg_query_go/v5"
)

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/v4
module github.com/pganalyze/pg_query_go/v5

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/v4"
"github.com/pganalyze/pg_query_go/v4/parser"
pg_query "github.com/pganalyze/pg_query_go/v5"
"github.com/pganalyze/pg_query_go/v5/parser"
)

var normalizeTests = []struct {
Expand Down

0 comments on commit 1896d12

Please sign in to comment.