This topic describes the ST_ForeignTables function. This function is used to query the name of a table in an external data source.

Syntax

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

Parameters

Parameter Description
source The data source that contains the table. For more information, see Object storage paths.
driver The driver that is used to access the data source. For more information, see ST_FDWDrivers. If you do not specify this parameter, 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://<ak_id>:<ak_secret>@<endpoint>/data')).*) table_test
    ORDER BY table_name::text ASC;
    
     -----------------
     poi
     road
     county
  • Use the ESRI Shapefile driver.
    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