Thread
Commits
-
Add a regression test script dedicated to exercising system views.
- d002f16c6ec3 10.0 landed
-
Create a separate test file for exercising system views
Tom Lane <tgl@sss.pgh.pa.us> — 2017-01-29T21:02:21Z
In connection with the "pg_hba_file_settings view patch" thread, I was wondering where we could logically insert a regression test case for that view. I realized that there is no natural home for it among the existing regression tests, because it's not really connected to any SQL language feature. The same is true for a number of other built-in views, and unsurprisingly, most of them are not exercised anywhere :-(. Accordingly, I propose creating a new regression test file whose charter is to exercise the SRFs underlying system views, as per attached. I don't think we desperately need new tests for views that expand to simple SQL, but these test cases correspond directly to code coverage for C functions, so they seem worthwhile. I did not do anything about testing the various pg_stat_xxx views. Those could be added later, or maybe they deserve their own home. (In many cases, those would need something smarter than the basic count(*) technique used here, because the C functions are invoked in the view's SELECT list not in FROM, so the planner would throw away those calls.) Comments/objections? regards, tom lane
-
Re: Create a separate test file for exercising system views
Andres Freund <andres@anarazel.de> — 2017-01-29T21:12:19Z
Hi, On 2017-01-29 16:02:21 -0500, Tom Lane wrote: > I did not do anything about testing the various pg_stat_xxx views. > Those could be added later, or maybe they deserve their own home. > (In many cases, those would need something smarter than the basic > count(*) technique used here, because the C functions are invoked > in the view's SELECT list not in FROM, so the planner would throw > away those calls.) I've previously wished there were a portable equivalent of \o /dev/null that'd not be perfect, but it'd still exercise more than what we currently have. Alternatively casting the entire row to text should allow to use count(*) trickery in some of the cases at least. > Comments/objections? Sounds like a good idea here. Greetings, Andres Freund
-
Re: Create a separate test file for exercising system views
Michael Paquier <michael.paquier@gmail.com> — 2017-01-30T05:02:12Z
On Mon, Jan 30, 2017 at 6:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > In connection with the "pg_hba_file_settings view patch" thread, I was > wondering where we could logically insert a regression test case for that > view. I realized that there is no natural home for it among the existing > regression tests, because it's not really connected to any SQL language > feature. The same is true for a number of other built-in views, and > unsurprisingly, most of them are not exercised anywhere :-(. > > Accordingly, I propose creating a new regression test file whose charter > is to exercise the SRFs underlying system views, as per attached. > I don't think we desperately need new tests for views that expand to > simple SQL, but these test cases correspond directly to code coverage > for C functions, so they seem worthwhile. > > I did not do anything about testing the various pg_stat_xxx views. > Those could be added later, or maybe they deserve their own home. > (In many cases, those would need something smarter than the basic > count(*) technique used here, because the C functions are invoked > in the view's SELECT list not in FROM, so the planner would throw > away those calls.) > > Comments/objections? Nice idea to group those tests in the same file. I am not noticing any issues with the patch proposed. -- Michael
-
Re: Create a separate test file for exercising system views
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> — 2017-01-30T06:42:27Z
On Mon, Jan 30, 2017 at 2:32 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > In connection with the "pg_hba_file_settings view patch" thread, I was > wondering where we could logically insert a regression test case for that > view. I realized that there is no natural home for it among the existing > regression tests, because it's not really connected to any SQL language > feature. The same is true for a number of other built-in views, and > unsurprisingly, most of them are not exercised anywhere :-(. > > Accordingly, I propose creating a new regression test file whose charter > is to exercise the SRFs underlying system views, as per attached. > I don't think we desperately need new tests for views that expand to > simple SQL, but these test cases correspond directly to code coverage > for C functions, so they seem worthwhile. > > I did not do anything about testing the various pg_stat_xxx views. > Those could be added later, or maybe they deserve their own home. > (In many cases, those would need something smarter than the basic > count(*) technique used here, because the C functions are invoked > in the view's SELECT list not in FROM, so the planner would throw > away those calls.) > > Comments/objections? > I think this is good in the given infrastructure. Thanks for working on it. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company