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 1hJ5jZ-0003sk-QZ for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Apr 2019 00:25:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hJ5jY-0004bl-1c for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Apr 2019 00:25:56 +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 1hJ5jX-0004Wk-NB for pgsql-hackers@lists.postgresql.org; Wed, 24 Apr 2019 00:25:55 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hJ5jP-0004pG-Vl for pgsql-hackers@lists.postgresql.org; Wed, 24 Apr 2019 00:25:55 +0000 Received: by mail-qt1-x841.google.com with SMTP id z16so18344685qtn.4 for ; Tue, 23 Apr 2019 17:25:47 -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=Hxhk6Cj4fdnAbH1iwB4sG1S0Ilpl8OK08wgImzL+Bl0=; b=TwrChOYNNrhYY3l+j1Lc3PlEZ1Cw+Do/48Qf3OhAjzwFV1RssulJg2Kz62scGg5YGm Rsn2lldXc8apuF3D4a5MKDrT50IwBJ01OEdE9xbvoMgEvN9MdvT+DEiKP9LTeLBE6KVN 70vsvw5ys7sof8zT7eVumk618Si6wGJgFfrHZW1/Vtq1sTe5bFVS/BvPm527QU2tmVB3 7oLY5kwxO935eQZVEPR0jkb3Fx8jyBSWVBB7k/g3VJMz8oKNjPG3HvM+fl9sU+9m2BdF xWvMdsZg/Y9ucPU1yERAwWpSRly4Nxdfd00E/5QsYX1CzYfeaMR6QR0D1fxvUZ1V0wya Fy4g== 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=Hxhk6Cj4fdnAbH1iwB4sG1S0Ilpl8OK08wgImzL+Bl0=; b=mUq7qVRPBU+BIu46ZcyrJ1B6iTxArs/Ho0UxR2jB/qm7uRifGb2BwyAx5+y2f0MBOo T1D8d6cgSoh59gOEJcRO99JS2qSfEiay1nWSR2QdFdBgt2Z6GcbCUbNQysCi6aOMCF5f hU0ogIc6CBpmWakbK6OmuypongGi6h3SJ6OAGAG8DSOqtxCSQH/icpVT5sl8cXihEKI9 Haix45JAlzsA+8tKpNZdTSiEybeiPbNjoxIqKOmOeT1xWjoHNn372q6kVhIDpxh9ThcA dZOjE95kmjrohSm3TiAlSVsZmZchd5e+fgMVznzRKsWsyL2qxETSmojERq27iOan0RFy Iyqw== X-Gm-Message-State: APjAAAUGdjdniKZkPk8OqRmk7i6dOY1BaW8xPA40pIPukDuU2KB0qIFB mSn1rwDVv2hvTw5GK7FdT77Lww== X-Google-Smtp-Source: APXvYqxXgPa5y4t2zlLkk3wiAnW6TFMKVCcMk9HBIfgWg7zDm33v1j7seeG74t2s5zrvyykYwVw7sg== X-Received: by 2002:a0c:adb3:: with SMTP id w48mr880691qvc.117.1556065546143; Tue, 23 Apr 2019 17:25:46 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([179.56.48.227]) by smtp.gmail.com with ESMTPSA id m18sm9311159qki.64.2019.04.23.17.25.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Apr 2019 17:25:44 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id C26E51203B8; Tue, 23 Apr 2019 20:25:41 -0400 (-04) Date: Tue, 23 Apr 2019 20:25:41 -0400 From: Alvaro Herrera To: David Rowley Cc: Robert Haas , Andres Freund , Tom Lane , PostgreSQL Hackers Subject: Re: pg_dump is broken for partition tablespaces Message-ID: <20190424002541.GA16596@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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-24, David Rowley wrote: > On Wed, 24 Apr 2019 at 10:26, Alvaro Herrera wrote: > > If creating a partition, there is the additional rule that parent's > > tablespace overrides default_tablespace: > > > > a2. if there's a TABLESPACE clause, use that. > > b2. otherwise, if the parent has a tablespace, use that. > > c2. otherwise, if there's a default_tablespace, use that. > > d2. otherwise, use the database tablespace. > > e2. if we end up with the database tablespace, overwrite with 0. > > Wouldn't it just take the proposed pg_dump change to get that? rule > e2 says we'll store 0 in reltablespace, even if the user does > TABLESPACE pg_default, so there's no requirement to adjust the hack in > heap_create to put any additional conditions on when we set > reltablespace to 0, so it looks like none of the patching work you did > would be required to implement this. Right? I'm not sure yet that 100% of the patch is gone, but yes much of it would go away thankfully. I do suggest we should raise an error if rule a3 hits and it mentions the database tablespace (I stupidly forgot this critical point in the previous email). I think astonishment is lesser that way. > The good part about that is that its consistent with what happens if > the user does TABLESPACE pg_default for any other object type that > supports tablespaces. i.e we always store 0. Yeah, it makes the whole thing a lot simpler. Note my note for further development of a feature (modelled after Robert's proposal) to allow the database tablespace to be specified, using either a separate pg_tablespace entry that means "use the database tablespace whatever that is" (Tom's suggestion), or a magic not-a-real-tablespace-OID number known to the code, such as 1 (Robert's). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services