pg 10 tds_fdw插件安装
tds_fdw安装
编译安装
使用root用户执行
tar -xzvf freetds-1.1.15.tar.gz
cd freetds-1.1.15
source /home/postgres/.bash_profile
./configure --prefix=/usr/local --with-openssl=/usr/include/openssl --with-tdsver=7.4
make
make install
unzip tds_fdw-master.zip
cd tds_fdw-master
make USE_PGXS=1
make USE_PGXS=1 install
使用postgres用户执行
ln -s /usr/local/lib/libsybdb.so.5 /home/postgres/10/lib/libsybdb.so.5
修改数据库参数配置
vi postgresql.conf
shared_preload_libraries = 'tds_fdw'
重启数据库服务
pg_ctl restart
步骤 4安装插件
进入到对应到数据库安装插件
psql -p 5431
psql (10.20)
Type "help" for help.
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
(4 rows)
postgres=# \c
You are now connected to database "postgres" as user "postgres".
postgres=# select * from pg_available_extensions;
name | default_version | installed_version | comment
-------------+-----------------+-------------------+-----------------------------------------------------------------------------------
plpgsql | 1.0 | 1.0 | PL/pgSQL procedural language
pageinspect | 1.6 | 1.6 | inspect the contents of database pages at a low level
tds_fdw | 2.0.2 | | Foreign data wrapper for querying a TDS database (Sybase or Microsoft SQL Server)
(3 rows)
postgres=# \c test
You are now connected to database "test" as user "postgres".
test=# \dx
List of installed extensions
Name | Version | Schema | Description
-------------+---------+------------+-------------------------------------------------------
pageinspect | 1.6 | public | inspect the contents of database pages at a low level
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(2 rows)
test=# create extension tds_fdw;
CREATE EXTENSION
test=# \dx
List of installed extensions
Name | Version | Schema | Description
-------------+---------+------------+-----------------------------------------------------------------------------------
pageinspect | 1.6 | public | inspect the contents of database pages at a low level
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
tds_fdw | 2.0.2 | public | Foreign data wrapper for querying a TDS database (Sybase or Microsoft SQL Server)
(3 rows)