Re: pg_dump: CREATE TABLE + CREATE RULE vs. relreplident - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pg_dump: CREATE TABLE + CREATE RULE vs. relreplident
Date
Msg-id 20150312141448.GC20199@awork2.anarazel.de
Whole thread Raw
In response to pg_dump: CREATE TABLE + CREATE RULE vs. relreplident  (Marko Tiikkaja <marko@joh.to>)
Responses Re: pg_dump: CREATE TABLE + CREATE RULE vs. relreplident
List pgsql-hackers
Hi,

On 2015-03-12 14:25:24 +0100, Marko Tiikkaja wrote:
> My colleague Per Lejontand brought to my attention that when dumping views
> with circular dependencies from a postgres version older than 9.4 using a
> recent pg_dump, the SQL looks something like the following:
> 
>   create table qwr();
>   create rule "_RETURN" as on select to qwr do instead select;
> 
> In this case the relreplident column in pg_class for the view ends up being
> 'd', instead of the 'n' normally used for views.  Patch to update
> relreplident when turning a table into a view is attached; this makes sure
> that the identity is NOTHING regardless of how the view was created.

I think that's a good idea.

> I consider this a bug fix, and suggest back patching to 9.4.

I agree on backpatching it. Arguably we could additionally avoid
emitting the ALTER TABLE ... REPLICA IDENTITY for views that have
already been created with identity set like this. But I doubt it's worth
it.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump: CREATE TABLE + CREATE RULE vs. relreplident
Next
From: Tom Lane
Date:
Subject: Re: logical column ordering