Skip to content

Releases: pganalyze/libpg_query

13-2.0.1

30 Mar 08:47
Compare
Choose a tag to compare
  • 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
$ shasum -a 256 libpg_query-13-2.0.1.*
e459db08c551ca11f008c3b8bc7add247781daed0043bd940c82de52331b5c72  libpg_query-13-2.0.1.tar.gz
7bee0b010bf9b60e8f49c15b7fe55cf2569ef6d5afc0cf37808e7be11768a398  libpg_query-13-2.0.1.zip

13-2.0.0

18 Mar 06:05
Compare
Choose a tag to compare
  • 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
  • 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
$ shasum -a 256 libpg_query-13-2.0.0.*

e5e6514b1ae0e1ab19a2441de3088988bf1b89778164f9c725c3d85c6903133e  libpg_query-13-2.0.0.tar.gz
066680c284bd82c2922562efc57bfbf848708785abd4d87798f0ceca72942888  libpg_query-13-2.0.0.zip

10-1.0.5

18 Mar 05:24
Compare
Choose a tag to compare
  • 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
$ shasum -a 256 libpg_query-10-1.0.5.*

b96ac0d09eecde3cfd2bb5cb0e7a251aab2ae9a2fe8be54ce83c973f20b6cb12  libpg_query-10-1.0.5.tar.gz
71acb837308d316366b17a820b0dca31137afd474c5a80e14d1ff7c9f673da12  libpg_query-10-1.0.5.zip

10-1.0.4

28 Dec 00:05
Compare
Choose a tag to compare
  • Update to latest Postgres 10 patch release (10.15)
  • PL/pgSQL parsing: Handle asprintf failures (and prevent compiler warning)

$ shasum -a 256 libpg_query-10-1.0.4.*

88cc90296e5fcaaebd0b360c46698b7c5badddf86f120e249ef682a820d41338  libpg_query-10-1.0.4.tar.gz
91e5146fc3c17f9897f40af62a1b2fd45039f28ddfa3a563ad3aa1e371471b27  libpg_query-10-1.0.4.zip

10-1.0.3

27 Dec 19:54
Compare
Choose a tag to compare
  • Update to latest Postgres 10 patch release (10.14)
  • Add support for ARM builds by explicitly copying ARM header file
  • Ignore return value of asprintf without compiler warnings @herwinw
  • Free stderr_buffer when parsing plpgsql @herwinw

$ shasum -a 256 libpg_query-10-1.0.3.*

1332761f31c198cb9825e6ccccda0b6a0e57daeb824870e8524df77f1592d149  libpg_query-10-1.0.3.tar.gz
6f2eb5d7b2d59d0298f269910e3b8cfa621ce446cc650ab57aa1a39169f23d5a  libpg_query-10-1.0.3.zip

9.5-1.4.2

04 Jan 23:52
Compare
Choose a tag to compare
  • Cut off fingerprints at 100 nodes deep to avoid excessive runtimes/memory
  • Fix warning on Linux due to missing asprintf include

9.5-1.4.1

12 Oct 23:20
Compare
Choose a tag to compare
  • Automatically call pg_query_init as needed to ease threaded usage

9.5-1.4.0

12 Oct 23:20
Compare
Choose a tag to compare
  • Clean up includes to avoid dependency on stdbool.h and xlocale.h
  • Change PL/pgSQL input to be the full CREATE FUNCTION statement
    • This is necessary for parsing, since we need the argument and return types
  • Fingerprinting Version 1.1
    • Only ignore ResTarget.name when parent field name is targetList and
      we have a SelectStmt as a parent node (fixes UpdateStmt fingerprinting)
  • Normalize the password in ALTER ROLE ... PASSWORD '123' statements
  • Make library thread-safe through thread-local storage #13

9.5-1.3.0

12 Oct 23:20
Compare
Choose a tag to compare
  • Extract source code using LLVM instead of manually compiling the right objects
    • This speeds up build times considerably since we don't download the Postgres
      source anymore, instead shipping a partial copy created as part of a release.
  • Experimental support for parsing PL/pgSQL source code (output format subject to change)

9.5-1.2.1

12 Oct 23:21
Compare
Choose a tag to compare
  • Make sure we encode special characters correctly in JSON output (@zhm #11)