Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fkFeJ-0003P1-H0 for pgsql-general@arkaria.postgresql.org; Mon, 30 Jul 2018 21:24:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fkFeI-0002u1-1s for pgsql-general@arkaria.postgresql.org; Mon, 30 Jul 2018 21:24:14 +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.89) (envelope-from ) id 1fkFeH-0002tt-Q2 for pgsql-general@lists.postgresql.org; Mon, 30 Jul 2018 21:24:13 +0000 Received: from mail-oi0-x231.google.com ([2607:f8b0:4003:c06::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fkFeE-0000yN-Gw for pgsql-general@postgresql.org; Mon, 30 Jul 2018 21:24:13 +0000 Received: by mail-oi0-x231.google.com with SMTP id n21-v6so24032497oig.3 for ; Mon, 30 Jul 2018 14:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=SUBad9ChRhOYqoNFWXsToVFcschVZ8HNyh7NBS7otuA=; b=DNFtjQPTlP10KU3cEGIUP3ygTPIaek+EQP3UNBBKrw3MMvTIHgT5ao+k3UibuHqF6F S0/pzABzy2HIfEjo8Pxns4+my9gX6tIUKKPY6x9JgQqqLt11/4XTcDA7hvmzjE9+dVMY XJy7r/GOfv2Mtg4BHXb6Oqndr6/eBXj0bfTTdZPcqpKulJh4ooDrh6mBaEoVSuuwswJV BHOONUFGDD2antqqRlTd1I2odttl0YTOhOkObKqvwCnXzRwGzLiRC7onhSe4UZOLcdIq 9S6YlrW4HY+mkb5RmE2Xi0GCU0VI0HDbU8w5SvC0JsDFQkDW+X4U0EOad5GEAc8lqKQw Jg6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=SUBad9ChRhOYqoNFWXsToVFcschVZ8HNyh7NBS7otuA=; b=kGTeucZjj00YCmxa4hFuBzFvOmYJEEgyLT2yMFJrcuX3zUExq2BdS38HNemeKItQzW KCO+YYb1iNiH8d0QsdlhG9VhOUf5iVJtObhtgwx3nEQ3i2HmwKAaGXTadBPOcitc7ni1 Sk5E6z6Zo6K9uAAAn8Nnujg7uAoiqqUQC1wxaWZzWOM0IzBvuDTDPQC2y4g+m1C2spa1 yhpO714wW+c3VEYsqHL/DWhsJX+MfGs70SYpEY1/EnJ3OrQgPBQStIEDEBR6uaz1hOy7 J+1o3GuYckCxCPkDF9SRn+aVfLMl15xiOkt6UDKL6fsRHBw9Er95KGZtZmcKeZPJkqBM b9OQ== X-Gm-Message-State: AOUpUlEIUgijfF9w10DhoABF+9C05fAJsUqaZK/99sB48lqwpHqA4VVD 0LHSVm+1M21f9o3WT3SZ0HDSQ/0U X-Google-Smtp-Source: AAOMgpcghd94Pggw+KDKP0SBy227XudBf61Z4TKCE4+KdohHwkK15KtGnuuQbGf4S2ET2hANCZSdnw== X-Received: by 2002:aca:438b:: with SMTP id q133-v6mr18797428oia.234.1532985848489; Mon, 30 Jul 2018 14:24:08 -0700 (PDT) Received: from [10.104.134.14] ([155.100.47.6]) by smtp.gmail.com with ESMTPSA id m24-v6sm7147367oic.26.2018.07.30.14.24.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Jul 2018 14:24:08 -0700 (PDT) Subject: Re: alter table docs To: Adrian Klaver , "pgsql-general@postgresql.org" References: From: Rob Sargent Message-ID: <20cf76d0-0873-249a-9cbe-2bb16caa4475@gmail.com> Date: Mon, 30 Jul 2018 15:24:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------DDC397A507380699E3F201D0" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------DDC397A507380699E3F201D0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 07/30/2018 03:07 PM, Adrian Klaver wrote: > On 07/30/2018 09:57 AM, Rob Sargent wrote: >> I was just looking up alter table add constraint syntax under >> "current(10)" and we get >> >>          ADD /table_constraint/ [ NOT VALID ] >>          ADD /table_constraint_using_index/ >> >> There is a description below for the using_index version but none for >> the plain version.  There is a block for the plain version on the CREATE > > I see one: > > https://www.postgresql.org/docs/10/static/sql-altertable.html > > "ADD table_constraint [ NOT VALID ] > >     This form adds a new constraint to a table using the same syntax > as CREATE TABLE, plus the option NOT VALID, which is currently only > allowed for foreign key and CHECK constraints. If the constraint is > marked NOT VALID, the potentially-lengthy initial check to verify that > all rows in the table satisfy the constraint is skipped. The > constraint will still be enforced against subsequent inserts or > updates (that is, they'll fail unless there is a matching row in the > referenced table, in the case of foreign keys; and they'll fail unless > the new row matches the specified check constraints). But the database > will not assume that the constraint holds for all rows in the table, > until it is validated by using the VALIDATE CONSTRAINT option. > " > >> TABLE page. Should it not also appear in the ALTER TABLE page? >> >> OK, I was expecting a block in the enclosing text-area for this simple form of the command similar to the one for the /using_index/ form.  I suppose the existence of the latter lead me to expect the former.  If it's as intended I'm fine with that. > > --------------DDC397A507380699E3F201D0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 07/30/2018 03:07 PM, Adrian Klaver wrote:
On 07/30/2018 09:57 AM, Rob Sargent wrote:
I was just looking up alter table add constraint syntax under "current(10)" and we get

         ADD /table_constraint/ [ NOT VALID ]
         ADD /table_constraint_using_index/

There is a description below for the using_index version but none for the plain version.  There is a block for the plain version on the CREATE

I see one:

https://www.postgresql.org/docs/10/static/sql-altertable.html

"ADD table_constraint [ NOT VALID ]

    This form adds a new constraint to a table using the same syntax as CREATE TABLE, plus the option NOT VALID, which is currently only allowed for foreign key and CHECK constraints. If the constraint is marked NOT VALID, the potentially-lengthy initial check to verify that all rows in the table satisfy the constraint is skipped. The constraint will still be enforced against subsequent inserts or updates (that is, they'll fail unless there is a matching row in the referenced table, in the case of foreign keys; and they'll fail unless the new row matches the specified check constraints). But the database will not assume that the constraint holds for all rows in the table, until it is validated by using the VALIDATE CONSTRAINT option.
"

TABLE page. Should it not also appear in the ALTER TABLE page?



OK, I was expecting a block in the enclosing text-area for this simple form of the command similar to the one for the using_index form.  I suppose the existence of the latter lead me to expect the former.  If it's as intended I'm fine with that.





--------------DDC397A507380699E3F201D0--