All Products
Search
Document Center

ApsaraDB RDS:ST_ForeignTables

Last Updated:Mar 28, 2026

Queries the names and IDs of tables in an external data source.

Syntax

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

Parameters

ParameterDescription

source

The data source that contains the tables. For more information, see Object storage paths.

driver

The driver used to access the data source. For more information, see ST_FDWDrivers. If not specified, the default driver is used.

id

The ID of the table.

table_name

The name of the table.

Examples

  • Use the default driver

    SELECT
           table_name
    FROM
         (select (ST_ForeignTables('OSS://<access_id>:<secrect_key>@[<Endpoint>]/<bucket>/path_to/file')).*) table_test
    ORDER BY table_name::text ASC;
    
     -----------------
     poi
     road
     county
  • Use the ESRI Shapefile driver

    SELECT
        table_name
    FROM
        (select (ST_ForeignTables('OSS://<access_id>:<secrect_key>@[<Endpoint>]/<bucket>/path_to/file', 'ESRI Shapefile')).*) table_test
    ORDER BY table_name::text ASC;
    
     -----------------
     poi
     road