Re: Add regression tests for SET xxx

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Robins Tharakan <tharakan(at)gmail(dot)com>
Cc: Szymon Guz <mabewlun(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add regression tests for SET xxx
Date: 2013-07-15 17:20:44
Message-ID: CA+TgmoYXvFLdqqCoUkPyLpTbnCdnZz=_ENJvsDWKjWG=qwjNJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jul 7, 2013 at 1:15 PM, Robins Tharakan <tharakan(at)gmail(dot)com> wrote:
> Updated the patch:
> - Updated ROLE names as per Robert's feedback (regress_xxx)
> - Added test to serial_schedule

Please see my comments on the LOCK tests related to these points and
update accordingly.

+BEGIN TRANSACTION;
+INVALID_COMMAND;
+ERROR: syntax error at or near "INVALID_COMMAND"
+LINE 1: INVALID_COMMAND;
+ ^
+SET SESSION AUTHORIZATION regress_role_var1;
+ERROR: current transaction is aborted, commands ignored until end of
transaction block

We have a test for this error message in the "transactions" test, so I
don't think we need another one here. This error is thrown at a very
high level in e.g. exec_simple_query. The only dependence on the
particular command is in IsTransactionExitStmt() - IOW, there's
nothing special about SET, and if we're going to test this for SET
ROLE and SET SESSION AUTHORIZATION, then why not for every single
command we have?

+SET DATESTYLE = ISO, SQL;
+ERROR: invalid value for parameter "DateStyle": "iso, sql"
+DETAIL: Conflicting "datestyle" specifications.
+SET DATESTYLE = SQL, ISO;
+ERROR: invalid value for parameter "DateStyle": "sql, iso"
+DETAIL: Conflicting "datestyle" specifications.
+SET DATESTYLE = ISO, POSTGRES;
+ERROR: invalid value for parameter "DateStyle": "iso, postgres"
+DETAIL: Conflicting "datestyle" specifications.
+SET DATESTYLE = POSTGRES, ISO;

...et cetera, ad nauseum. While there's something to be said for
completeness, the chances that future maintainers of this code will
update these regression tests with all the new permutations every time
new options are added seem low. I recommend testing a representative
sample of three of these, or so, and skipping the rest.

+SET TIME ZONE INTERVAL '1 month +05:30' HOUR TO MINUTE;
+ERROR: invalid value for parameter "TimeZone": "INTERVAL '@ 1 mon 5
hours 30 mins'"

Wow, what a terrible error message. This is not your patch's fault,
but maybe we should look at improving that?

I am inclined to think that these tests should be split up and moved
into the files where similar things are being tested already. The SET
TIME ZONE tests probably belong in horology.sql, the SET DATESTYLE
tests with the related tests in interval.sql, and much of the other
stuff in transactions.sql.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2013-07-15 17:24:06 Re: XLogInsert scaling, revisited
Previous Message Jeff Davis 2013-07-15 17:19:44 Re: Request for Patch Feedback: Lag & Lead Window Functions Can Ignore Nulls