环境准备
x86_linux_kylin v10 sp2
1、依赖
yum install -y uuid-devel
2、源代码
下载支持babelfish的pg,也是babelfish社区维护更新
#pg源码,支持babelfish版
git clone https://github.com/babelfish-for-postgresql/postgresql_modified_for_babelfish.git
#babelfish扩展
git clone https://github.com/babelfish-for-postgresql/babelfish_extensions.gitmv babelfish_extensions /opt/babelfish_extensions
mv postgresql_modified_for_babelfish /opt/postgresql_modified_for_babelfish
3、编译修改的pg
#创建安装目录
INSTALLATION_PATH=/usr/local/pgsql
mkdir "$INSTALLATION_PATH"#构建配置
cd /opt/postgresql_modified_for_babelfish./configure CFLAGS="-ggdb" \
--prefix=${INSTALLATION_PATH} \
--enable-debug \
--with-libxml \
--with-uuid=ossp \
--with-icu \
--with-extra-version="Babelfish for PostgreSQL"#编译pg
make -j4 && make install #编译pg扩展
cd contrib
make -j4 && make install
4、安装cmake和antlr
babelfishpg_tsql需要antlr
cd /usr/src
wget https://codeload.github.com/antlr/antlr4/zip/refs/tags/4.12.0
unzip 4.12.0
cd antlr4-4.12.0/
5、构建安装babelfish扩展
设置临时环境变量
export PG_CONFIG=$INSTALLATION_PATH/bin/pg_config
export PG_SRC=/opt/postgresql_modified_for_babelfish
export cmake=/usr/local/cmake-3.21.1/bin
编译
#babelfishpg_money
cd /opt/babelfish_extensions/contrib/babelfishpg_money
make
make install#babelfishpg_common
cd ../babelfishpg_common
make
make install#babelfishpg_tds
cd ../babelfishpg_tds
make
make install#babelfishpg_tsql
cd ../babelfishpg_tsql
make
make install