pg_hint_plan
pg_hint_plan copied to clipboard
The Variable "DATA" in the Makefile can't be work with install.pl in PostgresSQL source code
PostgreSQL verison: 12.3 pg_hint_plan version: REL12_1_3_7
I'm going to build the PostgreSQL project from source code,And I put the pg_hint_plan in the contrib folder before building.
Then I got two problem.
The first is in the pg_hint_plan.c line 54:
#include "plpgsql.h
the Head file plpgsql.h can't be import correctly,
I modified it to this below, then it works.
#include "../../src/pl/plpgsql/src/plpgsql.h",
The second problem is when run the install.bat, and it will get and error:
Could not copy contrib/pg_hint_plan/pg_hint_plan--*.sql to E:\Projects\PSQL\pgsql\/share/extension/pg_hint_plan--*.sql at E:\Projects\PSQL\postgresql-12.3\src\tools\msvc/Install.pm line 40. Install::lcopy("contrib/pg_hint_plan/pg_hint_plan--*.sql", "E:\\Projects\\PSQL\\pgsql\\/share/extension/pg_hint_plan--*.sql") called at E:\Projects\PSQL\postgresql-12.3\src\tools\msvc/Install.pm line 498 Install::CopySubdirFiles("contrib", "pg_hint_plan", HASH(0x2951f50), "E:\\Projects\\PSQL\\pgsql\\") called at E:\Projects\PSQL\postgresql-12.3\src\tools\msvc/Install.pm line 444 Install::CopyContribFiles(HASH(0x2951f50), "E:\\Projects\\PSQL\\pgsql\\") called at E:\Projects\PSQL\postgresql-12.3\src\tools\msvc/Install.pm line 115 Install::Install("E:\\Projects\\PSQL\\pgsql\\", undef) called at install.pl line 30
In the Makefile The "DATA" is in this line:
DATA = pg_hint_plan--*.sql
The reason is the install.pm treat it as a filename.
i just fixed it like this:
DATA = pg_hint_plan--1.3.5--1.3.6.sql pg_hint_plan--1.3.6--1.3.7.sql pg_hint_plan--1.3.7.sql
This is not supposed to be placed in contrib directory, and I didn't even tried to build this on Windows but I think it cannot be done a simple way. Some googling said me that you need to setup VS build project by your own.
Yeah, this would require a bit of trickery. If you have a portable way to add support for WIN32, please feel free to send a patch. Note that upstream is switching to meson/ninja as of PG16, so once we switch this project to use meson then this should not be a problem anymore for MSVC as src/tools/msvc/ would be gone from the PostgreSQL upstream tree.