0

I used the dblink (into postgresql) to create materialized views from another base. However, this way is not optimal I use it like this:

CREATE MATERIALIZED VIEW schema.vm_nom
AS SELECT t1.colonne1, t1.colonne2 , t3.geom 

   FROM dblink('hostaddr=127.0.0.1 port=5432 user=user dbname=dbname  password=psswrd', 
'select colonne1, colonne2, geom from schema.t1') t1(colonne1 varchar(24),  
colonne2 varchar(127), geom geometry(geometry, 2154))

Is there another way to do it, especially when calling columns with their type, this is very long?

I also thought of the fdw extension but I don't quite understand how it works. I specify that in my case, I connect 2 bases in local.

Thanks in advance.

yam0925
  • 9
  • 1
  • Are you trying to save keystroke/typing time, or execution time? – jjanes May 23 '23 at 16:06
  • I'm trying to save typing time. – yam0925 May 24 '23 at 07:12
  • So you *do* want a postgres_fdw, but I don't know what to tell you about it. Please read the docs on it (https://www.postgresql.org/docs/current/postgres-fdw.html), then ask specific questions. – jjanes May 24 '23 at 12:55

0 Answers0