Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEJjP-0008Nw-AQ for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Apr 2019 20:22:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hEJjM-0007IC-Mw for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Apr 2019 20:22:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEJjM-0007I5-EJ for pgsql-hackers@lists.postgresql.org; Wed, 10 Apr 2019 20:22:00 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEJjJ-0006Yp-5b for pgsql-hackers@lists.postgresql.org; Wed, 10 Apr 2019 20:22:00 +0000 Received: by mail-qt1-x843.google.com with SMTP id d13so4511422qth.5 for ; Wed, 10 Apr 2019 13:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Ys/LEAob8pf2NLOqsWToYwfpWNHsQNJQqOXa9K4pK84=; b=uylBVnrhVH0xsJa+LoSQ5WJEMipkL5TBEJzOjs3EXgPFtM9Gq9+Aalbd+az0O01rFQ Gioxf94uF2795DfKsb6ZXCJKoIVaBlOMZ1R0MAolMgs+bMjWdAaf4iOBdlzGlpLZexH7 /Be5oN9QX7vvcqOtBn63xzlPMq3rNFhQBgPi5dVTKh7fa5D0C+tmXx+Pd9esWyiixx5f eZ2xehY6EYomuzX/kAVHwWNHPDCRb3ZhF71Xhicv4ONZ209UGgME5qbHdxNiyttqPVCM PQy1aC13uNH2s2wxk6JmE2WyDdJO/RFDL3EVyxXuAOvbJmakK5p8Qy4VD9PWGCu9ck2g HMlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Ys/LEAob8pf2NLOqsWToYwfpWNHsQNJQqOXa9K4pK84=; b=SZcd48zIL4WwJlWNRf4Jr6KJ+/NHJvrYu6mtOXVad0qAj3E8XhJah420jy6GWQgMoY 2h+unmDOofP96Q68MGc3P0zJ+Rk7n5IloN/l3IP3SVFyyFjfLiGvS3TEZSXj/hA2rFC2 sDMBLiL0uR8webR54DpkEgi46PDx+PHCMT2Uv82hIBxAzeN1TvIg02S34OsWVk0JZlSy cD0vjUrTevPZvMmN7cNG5zfDMLoHZufIeX5LxgJLgr07CWjgtjsUuXjvdW0ctsRm1VR/ 2EjuKPAFZ9wc77J+uL50Yj6j04UAz3ROYfnaf8ZoPVlRfYcNFZfONRB3PSUPgJI2GiaV iR1g== X-Gm-Message-State: APjAAAUvoTKNBtpGBkPGGv5LWIV9Z2qritWRk7+XcMcrIybS4GDGxYOE xDjXywxnt7OPbHylMGnnfrQjXw== X-Google-Smtp-Source: APXvYqyRrYqMt69QTHdhKETZFEjF1Zglh4rDsFdNHsvhJswDrmAGU9Lo8DkxVerxOHJNeIooO/LkIQ== X-Received: by 2002:a0c:d0af:: with SMTP id z44mr36536602qvg.144.1554927715104; Wed, 10 Apr 2019 13:21:55 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id s12sm21632082qtj.1.2019.04.10.13.21.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Apr 2019 13:21:54 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 965AB120D5C; Wed, 10 Apr 2019 16:21:52 -0400 (-04) Date: Wed, 10 Apr 2019 16:21:52 -0400 From: Alvaro Herrera To: Andres Freund Cc: David Rowley , PostgreSQL Hackers Subject: Re: pg_dump is broken for partition tablespaces Message-ID: <20190410202152.GA10240@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190410161055.66wundhyxakt4fqo@alap3.anarazel.de> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Apr-10, Andres Freund wrote: > Hi, > > On 2019-04-10 09:28:21 -0400, Alvaro Herrera wrote: > > So I think that apart from David's patch, we should just document all > > these things carefully. > > Yea, I think that's the most important part. > > I'm not convinced that we should have any inheriting behaviour btw - it > seems like there's a lot of different ways to think this should behave, > with different good reason each. So, I ended up with the attached patch. I think it works pretty well, and it passes all my POLA tests. But it doesn't pass pg_upgrade tests! And investigating closer, it seems closely related to what David was complaining elsewhere about the tablespace being improperly set by some rewrite operations. Here's the setup as created by regress' create_table.sql: create table at_partitioned (a int, b text) partition by range (a); create table at_part_1 partition of at_partitioned for values from (0) to (1000); insert into at_partitioned values (512, '0.123'); create table at_part_2 (b text, a int); insert into at_part_2 values ('1.234', 1024); create index on at_partitioned (b); create index on at_partitioned (a); If you examine state at this point, it's all good: alvherre=# select relname, reltablespace from pg_class where relname like 'at_partitioned%'; relname | reltablespace ----------------------+--------------- at_partitioned | 0 at_partitioned_a_idx | 0 at_partitioned_b_idx | 0 but the test immediately does this: alter table at_partitioned alter column b type numeric using b::numeric; and watch what happens! (1663 is pg_default) alvherre=# select relname, reltablespace from pg_class where relname like 'at_partitioned%'; relname | reltablespace ----------------------+--------------- at_partitioned | 0 at_partitioned_a_idx | 0 at_partitioned_b_idx | 1663 (3 filas) Outrageous! I'm going to have a look at this behavior now. IMO it's a separate bug, but with that obviously we cannot fix the other one. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services