Re: BUG #13941: Different value "pg_constraint.consrc" for similar Check Constrait

From: Сергей Гавриленко <gsv371(at)ukr(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13941: Different value "pg_constraint.consrc" for similar Check Constrait
Date: 2016-02-11 00:08:29
Message-ID: 1455149309.421274929.ge8ksp8v@frv32.fwdcdn.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

От кого: "Andres Freund" <andres(at)anarazel(dot)de>
Дата: 11 февраля 2016, 01:56:06

On 2016-02-10 10:53:28 +0000, gsv371(at)ukr(dot)net wrote:
> PostgreSQL 9.5:
> 1.
> ALTER TABLE schedule ADD CONSTRAINT schedule_fact_quant_val CHECK
> (fact_quant BETWEEN 0 AND 23.59 AND (fact_quant - trunc(fact_quant)) <
> 0.6);
> result (pg_constraint.consrc): "(((fact_quant >= (0)::numeric) AND
> (fact_quant <= 23.59)) AND ((fact_quant - trunc(fact_quant)) < 0.6))"
> 2.
> ALTER TABLE schedule ADD CONSTRAINT schedule_fact_quant_val CHECK
> (((fact_quant >= (0)::numeric) AND (fact_quant <= 23.59)) AND ((fact_quant -
> trunc(fact_quant)) < 0.6));
> result (pg_constraint.consrc): "((fact_quant >= (0)::numeric) AND
> (fact_quant <= 23.59) AND ((fact_quant - trunc(fact_quant)) < 0.6))"
> ----------------------------------
> PostgreSQL 9.4 - identical results!

Why do you consider that a bug?

Regards,

Andres
Hi, just sorry for my english , it's Google translator .
This is the reason the lack of detailed description of the problems discussed in " bug " .
Maybe it's not a bug in the truest sense.
There is a process: In the empty base creates the necessary data structure .
Then, based on the contents of the tables " pg_catalog" obtain and maintain the description of this structure (snapshot).
In the future, comparing the (snapshot) with another (snapshot) received from the production database , a decision about the difference between the structures and the need to transform the production database .

The essence of the problem :
Developer creates check constrait according to [ 1 ] describe the bug .
In reference (s napshot) to store the result of [ 1 ] describe the bug .
The production database is missing the check constraint and the decision of its creation .
Add instruction is generated from the reference (snapshot) and corresponds to [2 ] describe the bug.
After this addition, we obtain check constrait which is functionally equivalent to the reference , but differs from the description of the reference .
And this in turn causes a re-creation check constrait for each of the subsequent verification of the production database structure.

Thank you and best regards .
Sergiy Gavrylenko.

 

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-02-11 01:36:05 Re: BUG #13941: Different value "pg_constraint.consrc" for similar Check Constrait
Previous Message Сергей Гавриленко 2016-02-11 00:07:26 Re: BUG #13941: Different value "pg_constraint.consrc" for similar Check Constrait