ossc-db / pg_store_plans

Store execution plans like pg_stat_statements does for queries.
http://ossc-db.github.io/pg_store_plans/
Other
54 stars 26 forks source link

Added support for PG(v.16.1) #31

Open LevNikolaev opened 10 months ago

LevNikolaev commented 10 months ago

Dear pg_store_plans Development Team,

I am pleased to submit this pull request, which brings forward compatibility updates and enhancements for PostgreSQL version 16.1, along with modifications for better support when building with cassert. Below, I have detailed the key changes made:

  1. Conditional Compilation Adaptation for PostgreSQL 16.1:

    • Updated conditional compilation checks in pg_store_plans.c. These modifications extend support to PostgreSQL 16.1, ensuring the codebase remains compatible with the latest PostgreSQL version.
  2. Header File Path Adjustments for PostgreSQL 16.1:

    • Incorporated new include paths (e.g., #include "nodes/queryjumble.h"), aligning with the changes in PostgreSQL 16.1’s directory structure and APIs.
  3. Variable Initializations for cassert Compatibility:

    • Adjusted the initialization of several static integer variables (track_level, plan_format, and plan_storage). These were previously uninitialized, potentially causing issues when building with cassert, as it necessitates all variables to be initialized to ensure robust error checking. I have set their default values to 1, aligning with the expected default behavior of the system.
    • This change enhances the stability of the module, especially in debug builds where cassert is commonly enabled, and ensures predictable behavior across different builds and environments.
  4. JSON and YAML Processing Function Modifications:

    • Altered JSON and YAML processing functions to be compatible with PostgreSQL 16.1’s updated behavior and API requirements. This ensures that the module's functionality concerning JSON and YAML processing remains stable and consistent with the latest PostgreSQL standards.
  5. Cleaning Up Outdated Conditional Compilations:

    • Removed conditional compilation directives that were specific to older PostgreSQL versions. This streamlines the codebase, making it more maintainable and easier to understand, while focusing support on more recent PostgreSQL versions.

The primary motivation behind these changes is to ensure that pg_store_plans stays up-to-date with the latest PostgreSQL release, while also addressing build compatibility issues when using cassert. This will not only benefit environments where strict error checking is required but also contribute to the overall reliability of the software.

I hope these updates will be valuable to the pg_store_plans project, and I am keen to discuss any aspects of this pull request or make further modifications if required.

Thank you for considering these enhancements.

Best regards, Lev Nikolaev, Tantor Labs

LevNikolaev commented 10 months ago

Dear pg_store_plans Development Team,

I am excited to present an update to my previous pull request, incorporating additional enhancements and necessary modifications for PostgreSQL version 16.1. These changes not only ensure compatibility but also introduce new requirements for the build process under PostgreSQL 16. Below, I have detailed the new key changes along with a summary of the previous updates:

New Changes:

  1. Significant Updates in Makefile for PostgreSQL 16 Support:

    • Enhanced the Makefile to incorporate logic for PostgreSQL 16 detection and support. This includes a conditional check for the PostgreSQL version to correctly configure the build process for this version.
    • Introduced conditional blocks that verify if PostgreSQL 16 is installed. If detected, additional compile flags (PG_CPPFLAGS) are set, targeting the use of appropriate PostgreSQL source directories.
    • Implemented checks for the presence of the PostgreSQL source code path (PATH_TO_SOURCE_CODE) and the gram.h file within the specified directory. This is critical for building with PostgreSQL 16, especially in light of changes in internal structure and API.
  2. Requirement of PostgreSQL Source Code for Building:

    • Specified that compiled PostgreSQL source code is required for building the extension with PostgreSQL 16, due to dependencies on certain internal header files and structures.
  3. Path Adjustments in pgsp_json.c:

    • Altered the include path for gram.h in pgsp_json.c, reflecting the new directory structure of PostgreSQL 16.

Summary of Previous Updates:

The overarching goal of these comprehensive updates is to ensure that pg_store_plans remains compatible with the latest PostgreSQL release, while addressing the new build requirements introduced in PostgreSQL 16. These changes aim to enhance the extension's robustness and adaptability across various build environments.

I hope these additional modifications will be beneficial to the pg_store_plans project. I am open to discussing any aspects of these changes and am ready to make further adjustments as needed.

Thank you for considering these enhancements to the project.

Best regards, Lev Nikolaev, Tantor Labs