From 543cbc9a1bc3bcfdee9e01b6cfa8d31186e4f457 Mon Sep 17 00:00:00 2001 From: msepga Date: Fri, 4 Aug 2023 16:56:35 -0400 Subject: [PATCH 1/4] Fix builds on glibc >= 2.38 `glibc` now defines `strchrnul`, so we add a check to see if `glibc` is being used, and instead import the symbol if so. --- Makefile | 3 ++- src/postgres/include/pg_config.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c0f68409..94f3e8e6 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,8 @@ $(PGDIR): echo "#undef USE_ARMV8_CRC32C" >> $(PGDIR)/src/include/pg_config.h echo "#undef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK" >> $(PGDIR)/src/include/pg_config.h # Ensure we don't fail on systems that have strchrnul support (FreeBSD and NetBSD) - echo "#if defined(__FreeBSD__) || defined(__NetBSD__)" >> $(PGDIR)/src/include/pg_config.h + echo "#include " >> $(PGDIR)/src/include/pg_config.h + echo "#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2))" >> $(PGDIR)/src/include/pg_config.h echo "#define HAVE_STRCHRNUL" >> $(PGDIR)/src/include/pg_config.h echo "#endif" >> $(PGDIR)/src/include/pg_config.h diff --git a/src/postgres/include/pg_config.h b/src/postgres/include/pg_config.h index 226809b3..502573b5 100644 --- a/src/postgres/include/pg_config.h +++ b/src/postgres/include/pg_config.h @@ -1032,6 +1032,7 @@ #undef HAVE__GET_CPUID #undef USE_ARMV8_CRC32C #undef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK -#if defined(__FreeBSD__) || defined(__NetBSD__) +#include +#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2)) #define HAVE_STRCHRNUL #endif From be2a67a991124d319fe028e3ba155edf3a368523 Mon Sep 17 00:00:00 2001 From: msepga Date: Fri, 4 Aug 2023 16:59:32 -0400 Subject: [PATCH 2/4] Bump version to 4.2.3 --- CHANGELOG.md | 4 ++++ Makefile | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01429d38..4cac5a45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All versions are tagged by the major Postgres version, plus an individual semver for this library itself. +## 15-4.2.3 2023-07-07 + +* Fix builds when compiling with `glibc >= 2.38` [#203](https://github.com/pganalyze/libpg_query/pull/203) + ## 15-4.2.2 2023-07-07 * Deparser: diff --git a/Makefile b/Makefile index 94f3e8e6..8101f8a8 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ PG_VERSION = 15.1 PG_VERSION_MAJOR = $(call word-dot,$(PG_VERSION),1) PROTOC_VERSION = 3.14.0 -VERSION = 4.2.2 +VERSION = 4.2.3 VERSION_MAJOR = $(call word-dot,$(VERSION),1) VERSION_MINOR = $(call word-dot,$(VERSION),2) VERSION_PATCH = $(call word-dot,$(VERSION),3) From 69240cca7201b5f7880c1ff15085167676285797 Mon Sep 17 00:00:00 2001 From: msepga Date: Fri, 4 Aug 2023 17:38:35 -0400 Subject: [PATCH 3/4] Include `stdlib.h` instead of `features.h` `features.h` is not available on all platforms. We can rely on it being included via `glibc`'s `stdlib.h` header. --- Makefile | 2 +- src/postgres/include/pg_config.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8101f8a8..c31b5198 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,7 @@ $(PGDIR): echo "#undef USE_ARMV8_CRC32C" >> $(PGDIR)/src/include/pg_config.h echo "#undef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK" >> $(PGDIR)/src/include/pg_config.h # Ensure we don't fail on systems that have strchrnul support (FreeBSD and NetBSD) - echo "#include " >> $(PGDIR)/src/include/pg_config.h + echo "#include " >> $(PGDIR)/src/include/pg_config.h echo "#if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2))" >> $(PGDIR)/src/include/pg_config.h echo "#define HAVE_STRCHRNUL" >> $(PGDIR)/src/include/pg_config.h echo "#endif" >> $(PGDIR)/src/include/pg_config.h diff --git a/src/postgres/include/pg_config.h b/src/postgres/include/pg_config.h index 502573b5..59a2288e 100644 --- a/src/postgres/include/pg_config.h +++ b/src/postgres/include/pg_config.h @@ -1032,7 +1032,7 @@ #undef HAVE__GET_CPUID #undef USE_ARMV8_CRC32C #undef USE_SSE42_CRC32C_WITH_RUNTIME_CHECK -#include +#include #if defined(__FreeBSD__) || defined(__NetBSD__) || (defined(__GLIBC__) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 38) || __GLIBC__ > 2)) #define HAVE_STRCHRNUL #endif From 613bd8183d08449d7ed52d70d39c0b558a25a469 Mon Sep 17 00:00:00 2001 From: msepga Date: Fri, 4 Aug 2023 17:43:18 -0400 Subject: [PATCH 4/4] Add note about PR #199 in 4.2.3 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cac5a45..dc833da3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All versions are tagged by the major Postgres version, plus an individual semver ## 15-4.2.3 2023-07-07 * Fix builds when compiling with `glibc >= 2.38` [#203](https://github.com/pganalyze/libpg_query/pull/203) +* Deparser: Add support for COALESCE and other expressions in LIMIT clause [#199](https://github.com/pganalyze/libpg_query/pull/199) ## 15-4.2.2 2023-07-07