Skip to content

Commit

Permalink
databases/libpg_query: update to 13-2.1.0
Browse files Browse the repository at this point in the history
Changelog:
https://github.com/pganalyze/libpg_query/blob/13-latest/CHANGELOG.md

13-2.1.0 2021-10-12

    Normalize: add funcname error object #121
    Normalize: Match GROUP BY against target list and re-use param refs #124
    PL/pgSQL: Setup namespace items for parameters, support RECORD types #123
        This significantly improves parsing for PL/pgSQL functions, to the extent that most functions should now parse successfully

13-2.0.7 2021-07-16

    Normalize: Don't modify constants in TypeName typmods/arrayBounds fields (#118)
        This matches how pg_stat_statement behaves, and avoids causing parsing errors on the normalized statement
    Don't fail builds on systems that have strchrnul support (FreeBSD)

13-2.0.6 2021-06-29

    Normalize: Don't touch "ORDER BY 1" expressions, keep original text #115
        This avoids obscuring the semantic meaning of integers in the ORDER BY clause, which is to reference a particular column in the target list.

13-2.0.5 2021-06-24

    Update to Postgres 13.3 patch release #114
    Add optional Makefile target to build as shared library #100
    Normalize: Don't touch "GROUP BY 1" type statements, keep original text #113
        This avoids obscuring the semantic meaning of integers in the GROUP BY clause, which is to reference a particular column in the target list.
    Fingerprint: Cache list item hashes to fingerprint complex queries faster #112
        This was exhibiting quite bad runtime behaviour before, causing both an explosion in memory, as well as very high CPU runtime for complex queries.
        The new approach ensures we don't calculate the hashes for a particular list more than once, which ensures that we roughly have quadratic runtime instead of exponential runtime.
    Deparser: Emit the RangeVar catalogname if present #105
    Fix crash in pg_scan function when encountering backslash escapes #109
    Integrate oss-fuzz fuzzer #106

13-2.0.4 2021-04-05

    Deparser: Fix crash in CopyStmt with HEADER or FREEZE inside WITH parens
        The parse tree does not contain an explicit argument in those cases, but does when specified in the legacy mode without the wrapping WITH.
        With this change we only output the "1" argument when the original tree also had this, to ensure parse tree comparisons match. Note the intent here is technically the same, which is to enable these options.

13-2.0.3 2021-04-02

    Normalize: Fix handling of two subsequent DefElem elements #96
        We were incorrectly adding too many DefElem locations to the recorded constant values, causing a crash when more than a single DefElem is present in a utility statement.

13-2.0.2 2021-03-30

    srcdata/nodetypes.json: Avoid bogus values accidentally parsed from inside comments

13-2.0.1 2021-03-30

    Fix ARM builds: Avoid dependency on cpuid.h header
    Simplify deparser of TableLikeClause #91 Lele Gaifax
    Fix asprintf warnings by ensuring _GNU_SOURCE is set early enough

13-2.0.0 2021-03-18

    Update to PostgreSQL 13 parser (13.2 release)
    Changes to JSON output format
        WARNING: These JSON format changes are incompatible with prior releases.
        New top-level result object that contains the Postgres version number the parser is based on
        Node type names are only output when the field is a generic field (Node*), but not when the field always has the same type. This matches how the Postgres source looks like, and ensures the JSON and (new) Protobuf format match in their structure. You can utilize the srcdata/struct_defs.json file as needed to get the necessary context on field types.
        Whitespace between control characters in JSON is no longer added
        "<" and ">" characters are escaped to avoid browser HTML injections
        Enum values are output with the value's name, instead of the integer value
    Introduce new Protobuf parse tree output format
        Up until now, this library relied on JSON to pass the parse result back to the caller, which has a number of downsides, most importantly that we don't have a readily available parser for JSON thats not tied to a running Postgres server. That in turn makes it hard to provide cross-language features such as deparsing directly in this library (which would require reading back a parse tree that gets passed in).
        Protobuf isn't perfect, but its straightforward enough to generate the schema definitions for the parse tree nodes, and output the tree using a bundled C protobuf library, which has a small enough SLOC count (~3k) to not be noticeable in the big picture.
    Add support for returning Postgres scanner result
        This allows utilizing pg_query for use cases that need the raw token information, instead of a parse tree. Due to additional modifications to the Postgres source, this also contains information about comments in the query string, and their location.
    Add deparsing functionality that turns parse tree back into a SQL query
        This is based on the deparser that was written over multiple years for the pg_query Ruby library, and is now accessible for all bindings through this new API and implementation.
    Fingerprinting: Introduce v3 version and 64-bit XXH3 hash
        See full details in the wiki page here: https://github.com/pganalyze/libpg_query/wiki/Fingerprinting#version-30-based-on-postgresql-13
    Add new pg_query_split_with_scanner/pg_query_split_with_parser functions to split up multi-statement strings
        Naively one could assume that splitting a string by ";" is sufficient, but it becomes tricky once one takes into consideration that this character can also show up in identifier, constants or comments.
        We provide both a parser-based split function and a scanner-based split function. Most importantly when splitting statements in a file that may contain syntax errors that cause a parser error, but are accepted by the scanner. Otherwise the parser-based split function is recommended due to better accuracy.
    Add experimental Protobuf C++ outfuncs, converge JSON output to match Protobuf mapped output
    Extract source with USE_ASSERT_CHECKING enabled
        This ensures we have the necessary functions to compile an assert-enabled build if necessary. Note that this doesn't mean that asserts are enabled by default (they are not, you need to explicitly use DEBUG=1).
    Ensure codebase has a clean Valgrind run
    PL/pgSQL: Output NEW/OLD variable numbers, record dno fields Ethan Resnick
    Makefile: Allow passing in customized CFLAGS/PG_CONFIGURE_FLAGS/TEST_* Ethan Resnick

10-1.0.5 2021-02-17

    Update to latest Postgres 10 patch release (10.16)
    Free Postgres top-level memory context on thread exit / with function
        Previously there was no way to free the top-level Postgres memory context, causing threaded programs that churn through a lot of threads to leak memory with each newly initialized thread-local top-level memory context.
        Instead, this uses a newly introduced cleanup method to free the memory when a pthread exits (note this causes a pthread dependency to be added to this library). In addition, primarily for memory testing purposes, add a new method "pg_query_exit" that performs the same cleanup on demand.
    Resolve correctness issues and possible memory leak in PL/pgSQL parser
    Add arch-ppc.h for PPC architectures #80 @pkubaj
  • Loading branch information
mfechner committed Feb 7, 2022
1 parent 28628c2 commit b66e075
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
6 changes: 1 addition & 5 deletions databases/libpg_query/Makefile
@@ -1,13 +1,9 @@
# Created by: Matthias Fechner <mfechner@FreeBSD.org>

PORTNAME= libpg_query
DISTVERSION= 10-1.0.4
PORTREVISION= 0
DISTVERSION= 13-2.1.0
CATEGORIES= databases devel

PATCH_SITES= https://github.com/lfittl/libpg_query/commit/
PATCHFILES= 820f5294f92927d6c4f61722bb28cf380942b83c.patch:-p1

MAINTAINER= mfechner@FreeBSD.org
COMMENT= C library for accessing the PostgreSQL parser outside of the server

Expand Down
8 changes: 3 additions & 5 deletions databases/libpg_query/distinfo
@@ -1,5 +1,3 @@
TIMESTAMP = 1609782591
SHA256 (lfittl-libpg_query-10-1.0.4_GH0.tar.gz) = 88cc90296e5fcaaebd0b360c46698b7c5badddf86f120e249ef682a820d41338
SIZE (lfittl-libpg_query-10-1.0.4_GH0.tar.gz) = 1508585
SHA256 (820f5294f92927d6c4f61722bb28cf380942b83c.patch) = 3d528a6d72aac8a3aa04c64d2218c43de9818baf2b0cbe54e7a075cbf069436c
SIZE (820f5294f92927d6c4f61722bb28cf380942b83c.patch) = 2374
TIMESTAMP = 1644225490
SHA256 (lfittl-libpg_query-13-2.1.0_GH0.tar.gz) = a01329ae5bac19b10b8ddf8012bd663a20f85f180d6d7b900c1a1ca8444d19a5
SIZE (lfittl-libpg_query-13-2.1.0_GH0.tar.gz) = 3541762

0 comments on commit b66e075

Please sign in to comment.