@@ -36,30 +36,31 @@ cp .env.source.example .env.source # fill in host/port/user/db/password (gitig
3636
3737## 11.3 Three things that need attention
3838
39- ### (a) Ownership / roles — objects are owned by ` ahi_dev `
40- This repo renamed its superuser to ** ` local_dev ` ** . Pick one:
39+ ### (a) Ownership / roles
40+ Objects in the dump are owned by whatever role owned them on the ** source**
41+ (call it ` <source_role> ` ). If that role doesn't exist in this target — whose
42+ superuser is ** ` local_dev ` ** — pick one:
4143
42- - ** Recommended (frictionless FDW):** also create a role named ` ahi_dev ` in the
43- target before importing, so owners * and* FDW user mappings restore verbatim:
44+ - ** Recommended (frictionless FDW):** create a matching role in the target
45+ before importing, so owners * and* FDW user mappings restore verbatim:
4446 ``` bash
4547 docker compose exec -T postgres psql -U local_dev -d local_db \
46- -c " CREATE ROLE ahi_dev LOGIN SUPERUSER PASSWORD 'pick-a-password';"
48+ -c " CREATE ROLE <source_role> LOGIN SUPERUSER PASSWORD 'pick-a-password';"
4749 ```
4850 Then import ** without** ` --no-owner ` (edit the script) to keep ownership.
4951- ** Pure ` local_* ` (default in our script):** import with
5052 ` --no-owner --no-privileges ` → everything ends up owned by ` local_dev ` . The
51- catch: the 5 ** FDW user mappings are tied to ` ahi_dev ` ** , so a ` local_dev `
52- session won't use them . Recreate them for ` local_dev ` (the import carries the
53+ catch: any ** FDW user mappings tied to ` <source_role> ` ** won't be used by a
54+ ` local_dev ` session . Recreate them for ` local_dev ` (the import carries the
5355 remote credentials into the catalog; copy them with):
5456 ``` sql
5557 -- as the importing user, inspect then recreate per server:
5658 SELECT srvname FROM pg_foreign_server;
57- -- CREATE USER MAPPING FOR local_dev SERVER gmf_imesys OPTIONS (username '...', password '...');
59+ -- CREATE USER MAPPING FOR local_dev SERVER <server> OPTIONS (username '...', password '...');
5860 ```
5961
60- > TL;DR: if you just want it to ** work immediately** , create the ` ahi_dev ` role
61- > in the target. If you want a clean ` local_* ` world, expect to redo 5 user
62- > mappings.
62+ > TL;DR: to ** work immediately** , recreate the source owner role in the target.
63+ > For a clean ` local_* ` world, expect to redo the user mappings.
6364
6465### (b) ` pg_cron ` jobs are NOT dumped
6566` pg_dump ` never carries ` cron.job ` rows. Recreate them after import:
@@ -71,7 +72,7 @@ docker compose exec -T postgres psql -U local_dev -d local_db \
7172
7273### (c) ` timescaledb ` is preloaded on the source — but unused
7374The source's ` shared_preload_libraries = 'timescaledb, pg_cron' ` , yet
74- ` timescaledb ` is ** not** created as an extension in ` ahi_db ` (no hypertables).
75+ ` timescaledb ` is ** not** created as an extension in the source database (no hypertables).
7576So the import does ** not** need it and will not fail. Only if you later intend to
7677use TimescaleDB features would you add ` postgresql-17-timescaledb ` to the
7778` Dockerfile ` and preload it.
0 commit comments