Opened 4 years ago

Closed 4 years ago

#4905 closed defect (fixed)

Revise shp2pgsql regress tests to properly test -Z

Reported by: robe Owned by: stefanpetrea
Priority: low Milestone: PostGIS 3.2.0
Component: utils/loader-dumper Version: master
Keywords: Cc:

Description

shp2pgsql ultimately generates an SQL output fed directly to psql.

Our shp2pgsql tests never output this SQL to compare against an expected. As a result #4628 could not be tested with it to confirm the ANALYZE line is not there since the result of database table created would be the same even without output. I think same holds for Index, but have to double-check that.

Change History (6)

comment:1 by robe, 4 years ago

Owner: changed from robe to average

comment:2 by stefanpetrea, 4 years ago

Owner: changed from average to stefanpetrea

comment:3 by stefanpetrea, 4 years ago

Currently, the SQL output generated by shp2pgsql is generated in a file but it's overwritten every time a new loader test is run.

In this pull request, a check is now in place if -Z was among the parameters passed to the loader, in which case, the generated SQL is checked for ANALYZE statements, and we expect there to be zero such statements there.

Please review pull request 611

comment:4 by stefanpetrea, 4 years ago

Okay, I've discussed with strk. The approach in PR 611 is to test if the SQL generated by the loader contains ANALYZE statements. This was done by modifying the run_test.pl Perl script.

There is another approach, which is to verify that no ANALYZE were run on the database by checking the system catalogs to see if the table statistics are up-to-date. I've discussed this with Sandro (@strk) and he likes this more than the previous approach.

Please review PR 612.

Note: There is a corner-case that we have to handle in the new approach, which is to not let autovacuum run on the tables in the test suite, so we're disabling autovacuum for those.

Last edited 4 years ago by stefanpetrea (previous) (diff)

comment:5 by robe, 4 years ago

Summary: Revise shp2pgsql regress tests to include checking sql outputRevise shp2pgsql regress tests to properly test -Z

comment:6 by Regina Obe <lr@…>, 4 years ago

Resolution: fixed
Status: newclosed

In 8245dd1/git:

Properly test -Z switch. Closes #4905
Closes https://github.com/postgis/postgis/pull/612

Note: See TracTickets for help on using tickets.