pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: movead.li@highgo.ca <movead.li@highgo.ca>
To: Michael Paquier <michael@paquier.xyz>
Cc: ibrar.ahmad <ibrar.ahmad@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: Re: Email to hackers for test coverage
Date: Tue, 27 Aug 2019 15:57:20 +0800
Message-ID: <2019082715571842080624@highgo.ca> (raw)
References: <20190822174636998766188@highgo.ca>
	<CALtqXTfnXR5EnxNdg4eCSQwD36PVHfKeNFNZ=N_MqNNyKyZEQw@mail.gmail.com>
	<201908242323292669324@highgo.ca>
	<20190826044840.GD7005@paquier.xyz>
	<2019082617105744807310@highgo.ca>
	<20190827060748.GE7422@paquier.xyz>


On Tue, 27 Aug 2019 14:07:48 +0800 michael@paquier.xyz wrote:
> There is a section in float4.sql which deals with overflow and
> underflow, so wouldn't it be better to move the tests there?  You 
> could just trigger the failures with that: 
> =# insert into float4_tbl values ('-10e-70'::float8); 
> ERROR:  22003: value out of range: underflow 
> LOCATION:  check_float4_val, float.h:145 
> =# insert into float4_tbl values ('-10e70'::float8); 
> ERROR:  22003: value out of range: overflow 
> LOCATION:  check_float4_val, float.h:140 
> I would also test all four patterns: 10e70, 10e-70, -10e70, -10e-70.
 
I think your way is much better, so I change the patch and it is  
'regression_20190827.patch' now.

> For the numeric part, this improves the case of
> ApplySortAbbrevFullComparator() where both values are not NULL.  Could
> things be done so as the other code paths are fully covered?  One
> INSERT is fine by the way to add the extra coverage.
There are code lines related to NULL values in
ApplySortAbbrevFullComparator(), but I think the code lines for
comparing a NULL and a NOT NULL can be never reached, because it is
handled in ApplySortComparator() which is called before
ApplySortAbbrevFullComparator(). So I think it is no use to INSERT
a NULL value.

--
Movead


Attachments:

regression_20190827.patch (application/octet-stream, 5.1K) download diff --git a/src/test/regress/expected/float4-misrounded-input.out b/src/test/regress/expected/float4-misrounded-input.out index d21e1fba1f..6c89af6394 100644 --- a/src/test/regress/expected/float4-misrounded-input.out +++ b/src/test/regress/expected/float4-misrounded-input.out @@ -24,6 +24,14 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); ERROR: "-10e-70" is out of range for type real LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); ^ +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8); +ERROR: value out of range: overflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8); +ERROR: value out of range: overflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8); +ERROR: value out of range: underflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8); +ERROR: value out of range: underflow INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400'); ERROR: "10e400" is out of range for type real LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400'); diff --git a/src/test/regress/expected/float4.out b/src/test/regress/expected/float4.out index 901abb1d27..d6c22c1752 100644 --- a/src/test/regress/expected/float4.out +++ b/src/test/regress/expected/float4.out @@ -24,6 +24,14 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); ERROR: "-10e-70" is out of range for type real LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); ^ +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8); +ERROR: value out of range: overflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8); +ERROR: value out of range: overflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8); +ERROR: value out of range: underflow +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8); +ERROR: value out of range: underflow INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400'); ERROR: "10e400" is out of range for type real LINE 1: INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400'); diff --git a/src/test/regress/expected/numeric.out b/src/test/regress/expected/numeric.out index 1cb3c3bfab..289c930265 100644 --- a/src/test/regress/expected/numeric.out +++ b/src/test/regress/expected/numeric.out @@ -1426,6 +1426,8 @@ INSERT INTO num_input_test(n1) VALUES ('555.50'); INSERT INTO num_input_test(n1) VALUES ('-555.50'); INSERT INTO num_input_test(n1) VALUES ('NaN '); INSERT INTO num_input_test(n1) VALUES (' nan'); +INSERT INTO num_input_test(n1) values('99999999999999999999999999.998'); +INSERT INTO num_input_test(n1) values('99999999999999999999999999.997'); -- bad inputs INSERT INTO num_input_test(n1) VALUES (' '); ERROR: invalid input syntax for type numeric: " " @@ -1459,17 +1461,19 @@ INSERT INTO num_input_test(n1) VALUES (' N aN '); ERROR: invalid input syntax for type numeric: " N aN " LINE 1: INSERT INTO num_input_test(n1) VALUES (' N aN '); ^ -SELECT * FROM num_input_test; - n1 ---------- - 123 - 3245874 - -93853 - 555.50 - -555.50 - NaN - NaN -(7 rows) +SELECT * FROM num_input_test ORDER BY n1 DESC; + n1 +-------------------------------- + NaN + NaN + 99999999999999999999999999.998 + 99999999999999999999999999.997 + 3245874 + 555.50 + 123 + -555.50 + -93853 +(9 rows) -- -- Test some corner cases for multiplication diff --git a/src/test/regress/sql/float4.sql b/src/test/regress/sql/float4.sql index afdb469dc8..393d98fb14 100644 --- a/src/test/regress/sql/float4.sql +++ b/src/test/regress/sql/float4.sql @@ -16,6 +16,11 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'); INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'); +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e70'::float8); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e70'::float8); +INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-70'::float8); +INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-70'::float8); + INSERT INTO FLOAT4_TBL(f1) VALUES ('10e400'); INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e400'); INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-400'); diff --git a/src/test/regress/sql/numeric.sql b/src/test/regress/sql/numeric.sql index a939412359..51895c426b 100644 --- a/src/test/regress/sql/numeric.sql +++ b/src/test/regress/sql/numeric.sql @@ -839,6 +839,8 @@ INSERT INTO num_input_test(n1) VALUES ('555.50'); INSERT INTO num_input_test(n1) VALUES ('-555.50'); INSERT INTO num_input_test(n1) VALUES ('NaN '); INSERT INTO num_input_test(n1) VALUES (' nan'); +INSERT INTO num_input_test(n1) values('99999999999999999999999999.998'); +INSERT INTO num_input_test(n1) values('99999999999999999999999999.997'); -- bad inputs INSERT INTO num_input_test(n1) VALUES (' '); @@ -850,7 +852,7 @@ INSERT INTO num_input_test(n1) VALUES ('5. 0 '); INSERT INTO num_input_test(n1) VALUES (''); INSERT INTO num_input_test(n1) VALUES (' N aN '); -SELECT * FROM num_input_test; +SELECT * FROM num_input_test ORDER BY n1 DESC; -- -- Test some corner cases for multiplication

view thread (15+ messages)  latest in thread

Message-ID: <2019082715571842080624@highgo.ca>
Permalink:  ../2019082715571842080624@highgo.ca/
Also on:    postgresql.org/message-id/2019082715571842080624@highgo.ca

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: movead.li@highgo.ca, michael@paquier.xyz, ibrar.ahmad@gmail.com
  Subject: Re: Email to hackers for test coverage
  In-Reply-To: <2019082715571842080624@highgo.ca>
  References: <20190822174636998766188@highgo.ca> <CALtqXTfnXR5EnxNdg4eCSQwD36PVHfKeNFNZ=N_MqNNyKyZEQw@mail.gmail.com> <201908242323292669324@highgo.ca> <20190826044840.GD7005@paquier.xyz> <2019082617105744807310@highgo.ca> <20190827060748.GE7422@paquier.xyz> <2019082715571842080624@highgo.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox