Extension module_pathname and .sql.in

  extension sql文件中的MODULE_PATHNAME和$libdir。control文件里面包含了module_pathname定义,可以传导过去,所以在exntension的sql中可以直接用module_pathname代替硬编码的$libdir/xxx。如下:

zjh_ext.control文件。

# zjh_ext extension
comment = 'test for ext'
default_version = '1.0'
module_pathname = '$libdir/zjh_ext'
relocatable = true
trusted = true

REGRESS

list of regression test cases (without suffix), see below. make installcheck运行。

REGRESS_OPTS

additional switches to pass to pg_regress。回归测试客户端工具。

ISOLATION

list of isolation test cases, see below for more details

ISOLATION_OPTS

additional switches to pass to pg_isolation_regress

http://www.light-pg.com/docs/lightdb/13.8-22.3/extend-pgxs.html

extension sql包装器。

/* contrib/zjh_ext/zjh_ext--1.0.sql */

-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION zjh_ext" to load this file. \quit

CREATE FUNCTION add_one(integer) RETURNS integer
AS 'MODULE_PATHNAME', 'add_one'
    LANGUAGE C STRICT;

-- note overloading of SQL function name "add_one"
CREATE FUNCTION add_one(double precision) RETURNS double precision
AS 'MODULE_PATHNAME', 'add_one_float8'
    LANGUAGE C STRICT;

 

https://tapoueh.org/blog/2011/05/extension-module_pathname-and-.sql.in/

posted @ 2021-10-17 22:27  zhjh256  阅读(116)  评论(0编辑  收藏  举报