PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15238
PG Version10.4
OSDebian
Opened2018-06-12 13:21:20+00
Reported byChristoph Berg
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15238
Logged by:          Christoph Berg
Email address:      (redacted)
PostgreSQL version: 10.4
Operating system:   Debian
Description:        

If a foreign table has a sequence attached (e.g. if the foreign table has a
"serial" column), and the foreign table owner is updated, the sequence owner
is not updated, leading to errors on restore:

create extension postgres_fdw;
create server pg foreign data wrapper postgres_fdw;
create foreign table a (a serial) server pg;
alter table a owner to postgres; -- some owner that is not the current
user

\d
              List of relations
 Schema │  Name   │     Type      │  Owner
────────┼─────────┼───────────────┼──────────
 public │ a       │ foreign table │ postgres
 public │ a_a_seq │ sequence      │ cbe -- original owner

pg_dump -s then emits a dump that cannot be restored:
...
CREATE FOREIGN TABLE public.a (
    a integer NOT NULL
)
SERVER pg;
ALTER FOREIGN TABLE public.a OWNER TO postgres;
CREATE SEQUENCE public.a_a_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;
ALTER TABLE public.a_a_seq OWNER TO cbe;
ALTER SEQUENCE public.a_a_seq OWNED BY public.a.a

-- ERROR:  55000: sequence must have same owner as table it is linked to

Messages

DateAuthorSubject
2018-06-12 13:21:20+00=?utf-8?q?PG_Bug_reporting_form?=BUG #15238: Sequence owner not updated when owning table is foreign
2018-06-15 03:29:19+00Peter EisentrautRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-06-15 03:40:01+00Alvaro HerreraRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-06-15 04:06:10+00Amit LangoteRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-09-25 12:06:35+00Christoph BergRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-09-26 00:09:29+00Michael PaquierRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-09-26 18:53:44+00Peter EisentrautRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-09-26 22:35:28+00Michael PaquierRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-09-26 23:52:04+00Tom LaneRe: BUG #15238: Sequence owner not updated when owning table is foreign
2018-09-27 03:11:34+00Michael PaquierRe: BUG #15238: Sequence owner not updated when owning table is foreign