pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Efrain J. Berdecia <ejberdecia@yahoo.com>
To: david.rowley@2ndquadrant.com <david.rowley@2ndquadrant.com>
To: Amit Langote <amitlangote09@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #15954: Unable to alter partitioned table to set log
Date: Wed, 14 Aug 2019 02:51:27 +0000 (UTC)
Message-ID: <950396924.5108495.1565751087812@mail.yahoo.com> (raw)
In-Reply-To: <CAKJS1f8wUtYNh3KLrOB=+r6Bio-vUeeS_jyisumz_5V0yok_Pg@mail.gmail.com>
References: <15954-b61523bed4b110c4@postgresql.org>
	<CA+HiwqFLG=vN3-H3+Xk2ef_iicnoUtA7tNeZfX7JJc7mGJVZ0w@mail.gmail.com>
	<CAKJS1f8wUtYNh3KLrOB=+r6Bio-vUeeS_jyisumz_5V0yok_Pg@mail.gmail.com>

Is there any way to check in the code whether the table is a parent and then allow the execution of the alter accordingly?
Or are you saying that any empty table we would not be able to change the unlogged state?
Should the logic to alter the table just ignore whether the table is empty or not?

Sent from Yahoo Mail on Android 
 
  On Tue, Aug 13, 2019 at 9:57 PM, David Rowley<david.rowley@2ndquadrant.com> wrote:   On Wed, 14 Aug 2019 at 13:47, Amit Langote <amitlangote09@gmail.com> wrote:
>
> On Wed, Aug 14, 2019 at 3:06 AM PG Bug reporting form
> > I have a partition table that I created unlogged. I'm using pg_partman to
> > manage the partition. I then proceeded to load data into it with a COPY
> > command.
> >
> > Afterwards, I ran an alter table set logged on the parent table but the
> > table still shows as UNLOGGED along with all its children.
> >
> > Is this broken?
>
> It is somewhat.  A workaround is to perform ALTER TABLE SET LOGGED
> individually on each partition.  Specifying LOGGED / UNLOGGED for the
> parent table is useless as things stand now.

I'd say it's broken in a sense that we can create an unlogged
partitioned table in the first place.  I think that should have been
blocked.

As for why ALTER TABLE <partitioned_table> SET LOGGED; does not work,
that's due to ATRewriteTables() skipping relations without storage in:

/* Relations without storage may be ignored here */
if (!RELKIND_HAS_STORAGE(tab->relkind))
continue;

meaning we never get to:

/*
* Select persistence of transient table (same as original unless
* user requested a change)
*/
persistence = tab->chgPersistence ?
tab->newrelpersistence : OldHeap->rd_rel->relpersistence;

I'm not too sure what we can do to fix this though. Ideally, we'd just
block UNLOGGED partitioned tables, but we can't really do that as a
bug fix in back branches since it might break someone's code.

We could maybe just fix it in master...

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

view thread (20+ messages)  latest in thread

Message-ID: <950396924.5108495.1565751087812@mail.yahoo.com>
Permalink:  ../950396924.5108495.1565751087812@mail.yahoo.com/
Also on:    postgresql.org/message-id/950396924.5108495.1565751087812@mail.yahoo.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: ejberdecia@yahoo.com, david.rowley@2ndquadrant.com, amitlangote09@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15954: Unable to alter partitioned table to set log
  In-Reply-To: <950396924.5108495.1565751087812@mail.yahoo.com>

* 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