Choose your database:
MS SQL Server
SQL Anywhere

Subscribe to our news:
Chris Passion: "I tried 3 different programs before yours and none would be so handy and helpful. PostgreSQL Maestro works great and couldn't be easier to install".
Simon Pills: "Someone finally invented an intuitively used and easily customized PostgreSQL database administration tool! Keep up the good work. I will be in touch. I am able to do this horrendous work because your software enabled me to create a new database with all necessary objects in several minutes! I am sure that I have found what I really need".


Add your opinion

PostgreSQL Maestro online Help

Prev Return to chapter overview Next

Foreign Tables

PostgreSQL allows to access data stored on an external PostgreSQL server using regular SQL queries. Such data is referred as foreign data. To access foreign data, you need to create a foreign server object, which defines how to connect to a particular external data source. Then you need to create one or more foreign tables, which define the structure of the remote data. A foreign table can be used in queries just like a normal table, but a foreign table has no storage in the PostgreSQL server.


To get data of table stored on another PostgreSQL server available for querying in the current database profile, in other words to add a new foreign table,

select the Foreign tables list or any object from that list in the explorer tree;
use the Create New Foreign Table ... item from the popup menu or press Ins;
specify options of this table in the Create Foreign Table Wizard.


The basic principles of Create Object Wizards in PostgreSQL Maestro are explained in a separate topic. Below you will find a description of wizard steps that are unique for the current object.


To change an existing foreign table, open the corresponding editor, modify necessary properties and click Apply changes.


Foreign table properties

The Name of the foreign table must be distinct from the name of any other foreign table, table, sequence, index, or view in the same schema.



The Options dialog allows to set options to be associated with the new foreign table or one of its columns. The allowed option names and values are specific to each foreign data wrapper and are validated using the foreign-data wrapper's validator function. Duplicate option names are not allowed (although it's OK for a table option and a column option to have the same name).



Server name shows the name of an existing foreign server that is used for the foreign table.


Foreign table fields list contains fields of table stored in external database which data are available in the current one.



The Name of a foreign table column usually must be the same as the underlying remote table column name. The data type of the column can include array specifiers. The column is not allowed to contain null values are marked as Not Null. The Default expression will be used in any insert operation that does not specify a value for the column. If there is no default for a column, then the default is null.


The Data tab displays the foreign table data as a grid or as info cards (see Data View for details). To edit/add a table record, use Data Input Form or type the new data directly in the grid (card). To export/import/get SQL dump of the foreign table data, invoke corresponding modules from the grid's popup menu. To view and edit the content of BLOB columns, run BLOB Editor.


Prev Return to chapter overview Next