Re: Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()
Дата
Msg-id 566021D6.3060501@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()  (amul sul <sul_amul@yahoo.co.in>)
Ответы Re: Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()  (amul sul <sul_amul@yahoo.co.in>)
Список pgsql-hackers
Hi Amul!

On 2015/12/03 17:52, amul sul wrote:
> Hi ALL,
> 
> Need your suggestions.
> initially_valid flag is added to make column constraint valid. (commit :
http://www.postgresql.org/message-id/E1Q2Ak9-0006hK-M4@gemulon.postgresql.org)
> 
> 
> IFAICU, initially_valid and skip_validation values are mutually exclusive at constraint creation(ref: gram.y), unless
itset explicitly.
 
> 
> Can we pass initially_valid instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints(), as shown
below?
> 

...

> 
> 
> This will make code more readable & in my case this could enable to skip validation of existing data as well as mark
checkconstraint valid, when we have assurance that modified/added constraint are valid.
 
> 
> Comments? Thoughts? 

Especially from a readability standpoint, I think using skip_validation
may be more apt. Why - the corresponding parameter of StoreRelCheck()
dictates what's stored in pg_constraint.convalidated. So, if
skip_validation is 'true' because user specified the constraint NOT VALID,
StoreRelCheck() will store the constraint with convalidated as 'false',
because, well, user wishes to "skip" the validation for existing rows in
the table and until a constraint has been verified for all rows in the
table, it cannot be marked valid. The user will have to separately
validate the constraint by issuing a ALTER TABLE VALIDATE CONSTRAINT
command at a time of their choosing.

OTOH, if NOT VALID was not specified, validation will not be skipped -
skip_validation would be 'false', so the constraint would be stored as
valid and added to the list of constraints to be atomically verified in
the last phase of ALTER TABLE processing.

Does that make sense?

Thanks,
Amit





В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Daniel Verite"
Дата:
Сообщение: Re: psql: add \pset true/false
Следующее
От: konstantin knizhnik
Дата:
Сообщение: Re: Logical replication and multimaster