PostgreSQL学习篇14.1 SQL/MED

SQL/MED是sql语言中管理外部数据的一个扩展标准。MED:management of external data。它通过定义一个外部数据包装器和数据连接类型来管理外部数据。9.1开始提供对SQL/MED的支持,通过SQL/MED可以连接到各种异构数据库或其他PostgreSQL数据库。其相当于一套连接其他数据源的框架和标准。
在SQL/MED标准中,实现了一下四类数据库对象来访问外部数据源:
foreign data wrapper:外部数据包装器,FDW。相当于定义外部数据驱动
server:外部数据服务器,相当于定义一个外部数据源,需要制定外部数据源的FDW
user mapping:用户映射,主要把外部数据源的用户映射到本地用户,用于控制权限
foreign table:外部表,把外部数据源映射成数据库中的一张外部表

FDW:  --使用之前,需要到crontab下,make  make install
创建FDW示例:、
postgres=# create extension file_fdw;
CREATE EXTENSION
postgres=# create server file_fdw_server foreign data wrapper file_fdw;
CREATE SERVER
postgres=# create foreign table passwd(
postgres(# username text,
postgres(# pass text,
postgres(# uid int4,
postgres(# gid int4,
postgres(# gecos text,
postgres(# home text,
postgres(# shell text
postgres(# ) server file_fdw_server
postgres-# options (format 'text', filename '/etc/passwd' ,delimiter ':', null '');
CREATE FOREIGN TABLE
postgres=# select * from passwd limit 5;
 username | pass | uid | gid | gecos  |      home      |     shell     
----------+------+-----+-----+--------+----------------+---------------
 root     | x    |   0 |   0 | root   | /root          | /bin/bash
 bin      | x    |   1 |   1 | bin    | /bin           | /sbin/nologin
 daemon   | x    |   2 |   2 | daemon | /sbin          | /sbin/nologin
 adm      | x    |   3 |   4 | adm    | /var/adm       | /sbin/nologin
 lp       | x    |   4 |   7 | lp     | /var/spool/lpd | /sbin/nologin
(5 rows)

postgres=#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
This release contains a variety of fixes from 14.0. For information about new features in major release 14, see Section E.2. A dump/restore is not required for those running 14.X. However, note that installations using physical replication should update standby servers before the primary server, as explained in the third changelog entry below. Also, several bugs have been found that may have resulted in corrupted indexes, as explained in the next several changelog entries. If any of those cases apply to you, it's recommended to reindex possibly-affected indexes after updating. Make the server reject extraneous data after an SSL or GSS encryption handshake (Tom Lane) A man-in-the-middle with the ability to inject data into the TCP connection could stuff some cleartext data into the start of a supposedly encryption-protected database session. This could be abused to send faked SQL commands to the server, although that would only work if the server did not demand any authentication data. (However, a server relying on SSL certificate authentication might well not do so.) The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2021-23214) Make libpq reject extraneous data after an SSL or GSS encryption handshake (Tom Lane) A man-in-the-middle with the ability to inject data into the TCP connection could stuff some cleartext data into the start of a supposedly encryption-protected database session. This could probably be abused to inject faked responses to the client's first few queries, although other details of libpq's behavior make that harder than it sounds. A different line of attack is to exfiltrate the client's password, or other sensitive data that might be sent early in the session. That has been shown to be possible with a server vulnerable to CVE-2021-23214. The PostgreSQL Project thanks Jacob Champion for reporting this problem. (CVE-2021-23222) Fix physical replication for cases where the primary crashes after shipping a WAL se

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

丹心明月

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值