Re: alter table docs

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: alter table docs
Date: 2018-07-30 21:29:42
Message-ID: 901e9c16-266f-f68b-6bf8-9261c86aaf7b@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 07/30/2018 02:24 PM, Rob Sargent wrote:
>
> 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.

Aah I see, you where referring to:

"and table_constraint_using_index is:

[ CONSTRAINT constraint_name ]
{ UNIQUE | PRIMARY KEY } USING INDEX index_name
[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY
IMMEDIATE ]
"

>
>
>>
>>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2018-07-30 21:32:34 Re: alter table docs
Previous Message Ken Tanzer 2018-07-30 21:26:53 Cosmetically-varying casts added to view definitions