From an AGOL layer URL to a fully-constrained Postgres table, populated, in a single call.
materialize_layer() runs the whole pipeline at once: it introspects the AGOL layer, generates the DDL (tables, constraints, lookups, triggers), applies it to a schema you choose (default data), and backfills the existing rows from AGOL. It's idempotent — safe to re-run.
sync_schema() to catch and apply schema drift later.SELECT agol_fdw.materialize_layer(
layer_url := 'https://services.arcgis.com/.../FeatureServer/0',
layer_name := 'poles',
target_schema := 'data'
);
-- result: data.poles exists as a real PostGIS table,
-- with geometry, domains, subtypes, rules, relationships,
-- and contingent values — and it's already populated.