Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cygJg-0007rX-QK for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Apr 2017 15:05:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cygJg-0000SK-AZ for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Apr 2017 15:05:48 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cygJe-0000Qw-QW for pgsql-hackers@postgresql.org; Thu, 13 Apr 2017 15:05:46 +0000 Received: from tamriel.snowman.net ([72.66.115.51]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cygJZ-00075V-NH for pgsql-hackers@postgresql.org; Thu, 13 Apr 2017 15:05:45 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id B4A3A5F794; Thu, 13 Apr 2017 11:05:40 -0400 (EDT) Date: Thu, 13 Apr 2017 11:05:40 -0400 From: Stephen Frost To: Robert Haas Cc: Amit Langote , Tom Lane , Noah Misch , Pg Hackers Subject: Re: pg_dump emits ALTER TABLE ONLY partitioned_table Message-ID: <20170413150540.GQ9812@tamriel.snowman.net> References: <20170409235057.GA2842536@tornado.leadboat.com> <7227.1491790247@sss.pgh.pa.us> <637efb89-0bef-1474-f28e-7e40e1f6d0a6@lab.ntt.co.jp> <20170411131233.GQ9812@tamriel.snowman.net> <4c4c2400-430b-2e78-3ce2-e7fede4353b4@lab.ntt.co.jp> <20170412192930.GJ9812@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="msW7Xnld7ZOPVjQL" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-91-generic (x86_64) X-Uptime: 10:54:21 up 278 days, 16:18, 34 users, load average: 0.18, 0.17, 0.15 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --msW7Xnld7ZOPVjQL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Robert, * Robert Haas (robertmhaas@gmail.com) wrote: > So I think I was indeed confused before, and I think you're basically > right here, but on one point I think you are not right -- ALTER TABLE > ONLY .. CHECK () doesn't work on a table with inheritance children > regardless of whether the children already have the matching > constraint: To be clear- I wasn't thinking about what's possible today with inheiritance or partitioning or in PG at all, but rather focusing on what a user is likely to expect and understand from the messaging. > rhaas=3D# create table foo (a int, b text); > CREATE TABLE > rhaas=3D# create table bar () inherits (foo); > CREATE TABLE > rhaas=3D# alter table only foo add check (a =3D 1); > ERROR: constraint must be added to child tables too > rhaas=3D# alter table only bar add check (a =3D 1); > ALTER TABLE > rhaas=3D# alter table only foo add check (a =3D 1); > ERROR: constraint must be added to child tables too If that's the case then we should really change that error message, in my view. I'd be happier if we did support adding the constraint after child tables exist, but if we don't, we shouldn't imply to the user that they can add it after adding it to the children. > So, regarding Amit's 0001: >=20 > - I think we should update the relevant hunk of the documentation > rather than just removing it. Alright. > - Should we similarly allow TRUNCATE ONLY foo and ALTER TABLE ONLY foo > .. to work on a partitioned table without partitions, or is that just > pointless tinkering? That seems to be the only case where, after this > patch, an ONLY operation will fail on a childless partitioned table. I'm less sure about TRUNCATE ONLY because that really isn't meaningful at all, is it? A partitioned table doesn't have any data to truncate and truncating it doesn't have any impact on what happens later, does it? Having a sensible error be reported if someone tries to do that would be good though. > Do you want to be responsible for committing these or should I do it? Sure, though I won't be able to today and I've got some doubts about the other patches. I'll have more time tomorrow though. Thanks! Stephen --msW7Xnld7ZOPVjQL Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJY75PEAAoJEO1sijiDR2RVyOkP/iJFrSl+7Ntry6pQZw2iigMq rOFTns+egRlx7R2d+S/tQ8dNLJMGCVEgYXldOVyUaXU/tZTZOUvUtaQt2yOX0WeM blfna5V1kF3esQceVEpWiW+WcLRRB8fBUzs3wfiA4cvr6eqE4MDbB3LF1hRX0AWK HUixgpfdjbFhIBazN8g7uDzkTWRIMAX8D1UGpzK44l4e7BeYdUikvMC22kwV9ido nqr3y3+rTbAfuOaXioCYJfmlzyVhNq0lovJUUE2y9d6SohYRG86J5E3now1u37cy n9WUaxkUn+x7MC720TlPGEgd0W6tG6wCle902Pzp1ZUhIx+Z0EUgLX0i33m9St6k Q112ZhUHFJrQpU5mh8S22GY2Er7bBAzlXCSvwcY4fBglVUNSV4xNPxpgUSzkwixH PWg57ou5L1hNkIoK8t9LBx4Lj2ROP4awlXbfSz4JX3NPUsod/RV4hOXwtwSksmdb vL/TuYE/1W/bGbBzJdVVZZWU9qpt0tLnvi3OzHx4efqAS33uxt8Pr4buXdoek5f9 rQrEe/2vA512UqoU81sJ1LpN/J0dZVbuxi1fBbHA2OOs1A+XAouvKJaMJ0tmT0S4 Asb03gTvWK+FkFQt9UeVSuhMktU/rKF/4j7HfJV6thygVoeUu/wbEMbgGbxfr2QZ 0b81cS0enNZnt9xAT9q/ =9Er4 -----END PGP SIGNATURE----- --msW7Xnld7ZOPVjQL--