From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: christoph.berg@credativ.de
Subject: BUG #15238: Sequence owner not updated when owning table is foreign
Date: Tue, 12 Jun 2018 13:21:20 +0000
Message-ID: <152880968046.32363.3930397030469114276@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15238
Logged by: Christoph Berg
Email address: christoph.berg@credativ.de
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, christoph.berg@credativ.de
Subject: Re: BUG #15238: Sequence owner not updated when owning table is foreign
In-Reply-To: <152880968046.32363.3930397030469114276@wrigleys.postgresql.org>
References: <152880968046.32363.3930397030469114276@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox