Thread: Test-cases for exclusion constraints is missing in alter_table.sql file

Test-cases for exclusion constraints is missing in alter_table.sql file

From
Ashutosh Sharma
Date:
Hi All,

While working on exclusion constraints for one of our internal
project, I noticed that there is no test-case for exclusion
constraints in alter_table.sql file. However, for other constraints i
could see lots of test-cases in alter_table.sql. There are hardly 1-2
test-cases for exclusion constraint using ALTER TABLE command (1 in
constraints.source and 1 for partitioned table in alter_table.sql).
Shouldn't we consider adding few test-cases for exclusion constraints
in alter_table.sql considering that we have added lots of test-cases
for other constraints in this file. Thoughts?

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com


Ashutosh Sharma <ashu.coek88@gmail.com> writes:
> While working on exclusion constraints for one of our internal
> project, I noticed that there is no test-case for exclusion
> constraints in alter_table.sql file. However, for other constraints i
> could see lots of test-cases in alter_table.sql. There are hardly 1-2
> test-cases for exclusion constraint using ALTER TABLE command (1 in
> constraints.source and 1 for partitioned table in alter_table.sql).
> Shouldn't we consider adding few test-cases for exclusion constraints
> in alter_table.sql considering that we have added lots of test-cases
> for other constraints in this file. Thoughts?

They're tested elsewhere, so this proposal seems rather duplicative.

            regards, tom lane


Re: Test-cases for exclusion constraints is missing inalter_table.sql file

From
Ashutosh Sharma
Date:
On Thu, Jan 18, 2018 at 12:00 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Ashutosh Sharma <ashu.coek88@gmail.com> writes:
>> While working on exclusion constraints for one of our internal
>> project, I noticed that there is no test-case for exclusion
>> constraints in alter_table.sql file. However, for other constraints i
>> could see lots of test-cases in alter_table.sql. There are hardly 1-2
>> test-cases for exclusion constraint using ALTER TABLE command (1 in
>> constraints.source and 1 for partitioned table in alter_table.sql).
>> Shouldn't we consider adding few test-cases for exclusion constraints
>> in alter_table.sql considering that we have added lots of test-cases
>> for other constraints in this file. Thoughts?
>
> They're tested elsewhere, so this proposal seems rather duplicative.
>

By elsewhere do you mean in the contrib module 'sepgsql'
(sepgsql/sql/ddl.sql) because other than that i didn't find any other
places having ALTER TABLE ... ADD CONSTRAINT ... EXCLUDE ... sort of
sql queries other than the files which i mentioned in my earlier
email. Thanks.

--
With Regards,
Ashutosh Sharma
EnterpriseDB:http://www.enterprisedb.com


Re: Test-cases for exclusion constraints is missing inalter_table.sql file

From
Amit Kapila
Date:
On Wed, Jan 17, 2018 at 1:04 PM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote:
> Hi All,
>
> While working on exclusion constraints for one of our internal
> project, I noticed that there is no test-case for exclusion
> constraints in alter_table.sql file. However, for other constraints i
> could see lots of test-cases in alter_table.sql. There are hardly 1-2
> test-cases for exclusion constraint using ALTER TABLE command (1 in
> constraints.source and 1 for partitioned table in alter_table.sql).
> Shouldn't we consider adding few test-cases for exclusion constraints
> in alter_table.sql considering that we have added lots of test-cases
> for other constraints in this file. Thoughts?
>


Adding test cases will generally be meaningful if there doesn't exist
any test to cover the specific code your new test wants to cover.  I
think before writing/submitting tests, you can once verify if there
already exists some tests which cover the code you want to target with
new tests.  You can refer code coverage report
@https://coverage.postgresql.org/ or else you can try to generate a
fresh code coverage report.


-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


Re: Test-cases for exclusion constraints is missing inalter_table.sql file

From
Peter Eisentraut
Date:
On 1/17/18 23:57, Ashutosh Sharma wrote:
> By elsewhere do you mean in the contrib module 'sepgsql'
> (sepgsql/sql/ddl.sql) because other than that i didn't find any other
> places having ALTER TABLE ... ADD CONSTRAINT ... EXCLUDE ... sort of
> sql queries other than the files which i mentioned in my earlier
> email. Thanks.

There is

ALTER TABLE partitioned ADD EXCLUDE USING gist (a WITH &&);

in alter_table.sql.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services