I have a precalc_isochrones_5_miles field in a joa_clinic table which needs to be updated based on the return from another database's drivetime_isochrones_IRFANfunction. I am able to establish cross-db connection using dblink and I am using the following in a loop to pass on four arguments to the drivetime_isochrones_IRFAN function. The function would return the_geom_isochrone geometry value.
do
$$
declare
f record;
begin
for f in SELECT clinic_long, clinic_lat FROM joa_clinics
loop
UPDATE joa_clinics SET precalc_isochrones_5_miles = the_geom_isochrone FROM
SELECT the_geom_isochrone FROM dblink('myconn', format('SELECT the_geom_isochrone FROM drivetime_isochrones_IRFAN(%L, %L, %L, %L, %L)', clinic_long,clinic_lat,8046,false) )
end loop;
end;
$$
But when I run this code, I get a syntax error:
SELECT the_geom_isochrone FROM dblink('myconn', format('SE...
How to fix it? Note: This is Postgresql 11 running in Windows and I am using pgAdmin.
Thank you!