pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Maksim Milyutin <m.milyutin@postgrespro.ru>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Robert Haas <robertmhaas@gmail.com>
To: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Partitioned tables and relfilenode
Date: Thu, 23 Mar 2017 17:27:14 +0300
Message-ID: <5c1adf61-3293-1365-e31c-b6f672446c73@postgrespro.ru> (raw)
In-Reply-To: <d937752c-bf74-5560-6b7c-a315efc1da77@lab.ntt.co.jp>
References: <2b0d42f2-3a53-763b-c9c2-47139e4b1c2e@lab.ntt.co.jp>
	<CA+TgmobMuL-wfhO5kJtk-du3m4nu4YrQ6HFFGHwa3hek2SH6kw@mail.gmail.com>
	<30f05f6d-7341-b9b0-a089-2b626abc133b@lab.ntt.co.jp>
	<CA+TgmoYiwviCDRi3Zk+QuXj1r7uMu9T_kDNq+17PCWgzrbzw8A@mail.gmail.com>
	<5f5688f7-809e-5be9-f2b1-75e8b62cf548@lab.ntt.co.jp>
	<a361f6c9-7262-1ad7-02a8-81014e36dde6@lab.ntt.co.jp>
	<CA+Tgmoa4f+0E5sHnNuHZ2vCH2xQb94dwqUdN0NniXFFxm-W1LA@mail.gmail.com>
	<b7f2d81d-9c9b-ba4e-5e00-edf626567256@lab.ntt.co.jp>
	<CA+TgmoaBXAF9b5vaVrDd+jZMJCKZ+868T4+TiB_9fYtySHq2VQ@mail.gmail.com>
	<ac0aac85-91a4-3079-d859-f2deb59df4ca@lab.ntt.co.jp>
	<CA+TgmoYMABB2ATSYS1cGaYsExzWEJ+fO8-cUTOP-WWOS6=natQ@mail.gmail.com>
	<6837c359-45c4-8044-34d1-736756335a15@lab.ntt.co.jp>
	<CA+TgmoZQkD7y3tL5k9EO284bw5FbEmEZmdVKZs2-QjqNQhSoOw@mail.gmail.com>
	<CA+Tgmob+E7p-9acPGq5+8UTRkNKp6veLw0HwN+jzdiM6342TJw@mail.gmail.com>
	<CA+Tgmoam=42VBHNh+6A57GRKXRJ2nNnNk6j331Vi2z=kH161jg@mail.gmail.com>
	<d937752c-bf74-5560-6b7c-a315efc1da77@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Hi!

I have noticed that there is scheduled unlinking of nonexistent physical 
storage under partitioned table when we execute DROP TABLE statement on 
this partitioned table. Though this action doesn't generate any error 
under typical behavior of postgres because the error of storage's lack 
is caught through if-statement [1] I think it is not safe.

My patch fixes this issue.

1. src/backend/storage/smgr/md.c:1385

-- 
Maksim Milyutin
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

  [text/x-patch] exclude_unlinking_storage_for_partitioned_table.patch (518B, ../5c1adf61-3293-1365-e31c-b6f672446c73@postgrespro.ru/2-exclude_unlinking_storage_for_partitioned_table.patch)
  download | inline diff:
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 3999e6e..36917c8 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -1823,7 +1823,8 @@ heap_drop_with_catalog(Oid relid)
 	 */
 	if (rel->rd_rel->relkind != RELKIND_VIEW &&
 		rel->rd_rel->relkind != RELKIND_COMPOSITE_TYPE &&
-		rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE)
+		rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE &&
+		rel->rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
 	{
 		RelationDropStorage(rel);
 	}

view thread (96+ messages)  latest in thread

Message-ID: <5c1adf61-3293-1365-e31c-b6f672446c73@postgrespro.ru>
Permalink:  ../5c1adf61-3293-1365-e31c-b6f672446c73@postgrespro.ru/
Also on:    postgresql.org/message-id/5c1adf61-3293-1365-e31c-b6f672446c73@postgrespro.ru

 ·  · 

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-hackers@postgresql.org
  Cc: m.milyutin@postgrespro.ru, Langote_Amit_f8@lab.ntt.co.jp, robertmhaas@gmail.com
  Subject: Re: Partitioned tables and relfilenode
  In-Reply-To: <5c1adf61-3293-1365-e31c-b6f672446c73@postgrespro.ru>

* 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