Re: BUG #16703: pg-dump fails to process recursive view definition
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2020-11-05T16:20:29Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Revert "Accept relations of any kind in LOCK TABLE".
- f07811009ffd 12.5 landed
- ec516818a81a 10.15 landed
- 9e555180f23d 9.6.20 landed
- 549fd3d3bc24 11.10 landed
- 43c2e97ed45d 9.5.24 landed
- eeda7f633809 14.0 landed
- 4352c2394a54 13.1 landed
-
Revert "pg_dump: Lock all relations, not just plain tables".
- fa3840c8800f 13.1 landed
- f4fa4a82133f 12.5 landed
- dee1fe5e339a 10.15 landed
- 9e98ddd16e06 9.5.24 landed
- 802c460a27cc 11.10 landed
- 768ab4d676aa 9.6.20 landed
- d3adaabaf7d5 14.0 landed
-
Doc: undo mistaken adjustment to LOCK TABLE docs in back branches.
- 8b4121903c2d 9.5.24 landed
- 583fcf2f5759 9.6.20 landed
- 33862cb9c13a 10.15 landed
-
Don't throw an error for LOCK TABLE on a self-referential view.
- 7dc18c619dac 11.10 landed
- 5b7bfc39726f 14.0 landed
- 44b973b91029 13.1 landed
- 0bdf1ef3d53e 12.5 landed
Further news: I thought to myself "let's leave a self-referential view
behind in the final regression test state, so we can actually exercise
pg_dump/pg_upgrade with one". It turns out that that's not gonna work,
at least not right away. pg_dump dumps the view all right, but it dumps
CREATE VIEW "public"."self_referential_view" AS
SELECT "self_referential_view"."key",
"self_referential_view"."data"
FROM "public"."self_referential_view";
which of course fails to load, complaining "relation
"public.self_referential_view" does not exist".
I'm not particularly desperate to do anything about that. It's important
that pg_dump not fail on such a view, so you don't have a risk that your
backups didn't work at all. But if you have to do some finagling to
restore it, that's less critical. Also, this has been the situation all
along and there have been no complaints.
One could imagine getting pg_dump to handle this by treating the
self-reference as a circular reference and then doing what it does
to break reference loops with views. I experimented briefly with
that, but it's a bigger can of worms than it seems; pg_dump_sort.c
does not seem to have quite enough info to tell whether references
are explicit self-references or not.
regards, tom lane