Support Control `directory` Directive
I wanted to use the directory control file option; from the docs:
directory(string) The directory containing the extension's SQL script file(s). Unless an absolute path is given, the name is relative to the installation'sSHAREDIRdirectory. The default behavior is equivalent to specifyingdirectory = 'extension'.
Sadly it does not currently work after pgrx install:
ERROR SQLSTATE[58P01]: could not open directory "/Users/david/.pgrx/13.14/pgrx-install/share/postgresql/jsonschema": No such file or directory
query: CREATE EXTENSION jsonschema CASCADE;
PGXS doesn't know about it, either, requiring the MODULEDIR variable to be set to the same value. Here's how I enabled it for semver, which is a PGXS/C extension.
I think how it should work for pgrx is, if the directory field is set in the control file, it should copy the SQL files to the appropriate directory:
- When it's a relative path, it means that instead of installing them in
SHAREDIR/$directoryinstead ofSHAREDIR/extension. Basically its default value isextension. - If it's an absolute path then it should be put the SQL files at that path.
I believe the option only applies to the SQL files; DSOs still go into PKGLIBDIR and the control file in SHAREDIR/extension (for now).