全部產品
Search
文件中心

PolarDB:ST_ForeignTables

更新時間:Jul 06, 2024

查詢外部資料源中表的名稱。

文法

setof record ST_ForeignTables(cstring source,
                              cstring driver default '',
                              out integer id,
                              out cstring table_name);

參數

參數名稱描述
source資料來源,參見Object Storage Service服務路徑
driver使用的資料來源驅動程式,可以通過ST_FDWDrivers函數獲得。如果傳入Null 字元串,則表示使用預設的驅動嘗試訪問。
id表名序號。
table_name表名稱。

樣本

  • 使用預設的驅動
    SELECT
           table_name
    FROM
         (select (ST_ForeignTables('OSS://<ak_id>:<ak_secret>@<endpoint>/data')).*) table_test
    ORDER BY table_name::text ASC;
    
     -----------------
     poi
     road
     county
  • 使用Esri Shapefile驅動
    SELECT
        table_name
    FROM
        (select (ST_ForeignTables('OSS://<ak_id>:<ak_secret>@<endpoint>/data', 'ESRI Shapefile')).*) table_test
    ORDER BY table_name::text ASC;
    
     -----------------
     poi
     road