h3-pg icon indicating copy to clipboard operation
h3-pg copied to clipboard

Building against PostgreSQL 17 with pgindent

Open CtrlC-Root opened this issue 6 months ago • 1 comments

I had to make the following change to build this from source:

root@25fb469edc54:/h3-pg# git diff
diff --git a/cmake/AddPostgreSQLExtension.cmake b/cmake/AddPostgreSQLExtension.cmake
index a9a8cf7..6fdee23 100644
--- a/cmake/AddPostgreSQLExtension.cmake
+++ b/cmake/AddPostgreSQLExtension.cmake
@@ -88,7 +88,7 @@ function(PostgreSQL_add_extension LIBRARY_NAME)
   # Setup auto-format
   if(PostgreSQL_INDENT)
     add_custom_target("format_${EXTENSION_NAME}"
-      COMMAND ${PostgreSQL_INDENT} ${EXTENSION_SOURCES}
+      COMMAND ${PostgreSQL_INDENT} --typedefs=/usr/share/postgresql/17/typedefs.list ${EXTENSION_SOURCES}
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
       COMMENT "Formatting ${EXTENSION_NAME} sources"
     )

Here's the container setup for where I'm building this:

FROM docker.io/library/postgres:17 AS database

RUN apt-get update && \
    apt-get install \
        build-essential \
        clang-format \
        clang-tidy \
        cmake \
        postgresql-server-dev-17 \
        postgresql-server-dev-17-dbgsym

Not sure if my environment is weird or if this is something that's changed from previous Postgres releases.

CtrlC-Root avatar May 23 '25 21:05 CtrlC-Root

Thanks for the heads-up!

  • Did it work previously?
  • What was the error message?
  • Are you trying to compile a custom build or just install a regular release?

The intention is for pgindent to be ignored unless installed. I should probably make sure auto-format is not run as part of a regular install. 🤔

zachasme avatar Jun 06 '25 08:06 zachasme