Update PostgreSQL foreign data wrappers automatically on server connection in DBeaver

224 views Asked by At

I have set up foreign data wrappers (FDW) between two PostgreSQL dev servers in DBeaver. This enables me to execute queries that call tables in both servers, which is very useful.

However, table information is not updated for tables accessed through a FDW, which means that queries sometimes fail due to changes in a table (column name change, for instance). Since this is a development environment, this type of change is to be expected. The only way of updating a FDW foreing table, in my experience, is to drop and recreate it.

Is it possible to run a FDW foreign table creation script automatically on server connection? Dropping and recreating all FDWs foreign tables upon connection would update informations on all foreign tables and make sure that queries always use updated information.

I have tried using the Shell Command window in the Connection Properties window to call my FDW creation script but this does not seem to have any effect apart from displaying an empty psql pane on startup. FDWs are not updated.

Version info DBeaver 21.2.1 PostgreSQL 12.2

0

There are 0 answers