You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by de...@apache.org on 2021/04/22 01:40:07 UTC

[incubator-age] branch master updated: Add NULL regression tests for agtype and numbers

This is an automated email from the ASF dual-hosted git repository.

dehowef pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-age.git


The following commit(s) were added to refs/heads/master by this push:
     new cb75d48  Add NULL regression tests for agtype and numbers
cb75d48 is described below

commit cb75d484b35ad6b5da057487c111592ca02d990b
Author: Dehowe Feng <de...@gmail.com>
AuthorDate: Tue Apr 20 17:18:58 2021 -0700

    Add NULL regression tests for agtype and numbers
    
    Added and refactored regression tests for null operations.
---
 regress/expected/agtype.out | 132 +++++++++++++++++++++++++++++++++++++++-----
 regress/sql/agtype.sql      |  28 ++++++++--
 2 files changed, 139 insertions(+), 21 deletions(-)

diff --git a/regress/expected/agtype.out b/regress/expected/agtype.out
index 1022e95..16c9830 100644
--- a/regress/expected/agtype.out
+++ b/regress/expected/agtype.out
@@ -908,6 +908,36 @@ SELECT agtype_any_mod('null'::agtype, 1);
  
 (1 row)
 
+SELECT agtype_any_add(null, '1'::agtype);
+ agtype_any_add 
+----------------
+ 
+(1 row)
+
+SELECT agtype_any_sub(null, '1'::agtype);
+ agtype_any_sub 
+----------------
+ 
+(1 row)
+
+SELECT agtype_any_mul(null, '1'::agtype);
+ agtype_any_mul 
+----------------
+ 
+(1 row)
+
+SELECT agtype_any_div(null, '1'::agtype);
+ agtype_any_div 
+----------------
+ 
+(1 row)
+
+SELECT agtype_any_mod(null, '1'::agtype);
+ agtype_any_mod 
+----------------
+ 
+(1 row)
+
 SELECT 1 + 'null'::agtype;
  ?column? 
 ----------
@@ -938,33 +968,33 @@ SELECT 1 % 'null'::agtype;
  
 (1 row)
 
-SELECT agtype_any_add('null'::agtype, 1);
- agtype_any_add 
-----------------
+SELECT '1'::agtype + null;
+ ?column? 
+----------
  
 (1 row)
 
-SELECT agtype_any_sub('null'::agtype, 1);
- agtype_any_sub 
-----------------
+SELECT '1'::agtype - null;
+ ?column? 
+----------
  
 (1 row)
 
-SELECT agtype_any_mul('null'::agtype, 1);
- agtype_any_mul 
-----------------
+SELECT '1'::agtype * null;
+ ?column? 
+----------
  
 (1 row)
 
-SELECT agtype_any_div('null'::agtype, 1);
- agtype_any_div 
-----------------
+SELECT '1'::agtype / null;
+ ?column? 
+----------
  
 (1 row)
 
-SELECT agtype_any_mod('null'::agtype, 1);
- agtype_any_mod 
-----------------
+SELECT '1'::agtype % null;
+ ?column? 
+----------
  
 (1 row)
 
@@ -1004,6 +1034,42 @@ SELECT 1 >= 'null'::agtype;
  
 (1 row)
 
+SELECT '1'::agtype = null;
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT '1'::agtype <> null;
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT '1'::agtype < null;
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT '1'::agtype > null;
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT '1'::agtype <= null;
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT '1'::agtype >= null;
+ ?column? 
+----------
+ 
+(1 row)
+
 SELECT agtype_any_eq('null'::agtype, 1);
  agtype_any_eq 
 ---------------
@@ -1040,6 +1106,42 @@ SELECT agtype_any_ge('null'::agtype, 1);
  
 (1 row)
 
+SELECT agtype_any_eq(null, '1'::agtype);
+ agtype_any_eq 
+---------------
+ 
+(1 row)
+
+SELECT agtype_any_ne(null, '1'::agtype);
+ agtype_any_ne 
+---------------
+ 
+(1 row)
+
+SELECT agtype_any_lt(null, '1'::agtype);
+ agtype_any_lt 
+---------------
+ 
+(1 row)
+
+SELECT agtype_any_gt(null, '1'::agtype);
+ agtype_any_gt 
+---------------
+ 
+(1 row)
+
+SELECT agtype_any_le(null, '1'::agtype);
+ agtype_any_le 
+---------------
+ 
+(1 row)
+
+SELECT agtype_any_ge(null, '1'::agtype);
+ agtype_any_ge 
+---------------
+ 
+(1 row)
+
 --
 -- Test orderability of comparison operators =, <>, <, >, <=, >=
 -- These should all return true
diff --git a/regress/sql/agtype.sql b/regress/sql/agtype.sql
index f6ee3f3..e08089b 100644
--- a/regress/sql/agtype.sql
+++ b/regress/sql/agtype.sql
@@ -275,18 +275,22 @@ SELECT agtype_any_sub('null'::agtype, 1);
 SELECT agtype_any_mul('null'::agtype, 1);
 SELECT agtype_any_div('null'::agtype, 1);
 SELECT agtype_any_mod('null'::agtype, 1);
+SELECT agtype_any_add(null, '1'::agtype);
+SELECT agtype_any_sub(null, '1'::agtype);
+SELECT agtype_any_mul(null, '1'::agtype);
+SELECT agtype_any_div(null, '1'::agtype);
+SELECT agtype_any_mod(null, '1'::agtype);
 
 SELECT 1 + 'null'::agtype;
 SELECT 1 - 'null'::agtype;
 SELECT 1 * 'null'::agtype;
 SELECT 1 / 'null'::agtype;
 SELECT 1 % 'null'::agtype;
-
-SELECT agtype_any_add('null'::agtype, 1);
-SELECT agtype_any_sub('null'::agtype, 1);
-SELECT agtype_any_mul('null'::agtype, 1);
-SELECT agtype_any_div('null'::agtype, 1);
-SELECT agtype_any_mod('null'::agtype, 1);
+SELECT '1'::agtype + null;
+SELECT '1'::agtype - null;
+SELECT '1'::agtype * null;
+SELECT '1'::agtype / null;
+SELECT '1'::agtype % null;
 
 SELECT 1 = 'null'::agtype;
 SELECT 1 <> 'null'::agtype;
@@ -294,6 +298,12 @@ SELECT 1 < 'null'::agtype;
 SELECT 1 > 'null'::agtype;
 SELECT 1 <= 'null'::agtype;
 SELECT 1 >= 'null'::agtype;
+SELECT '1'::agtype = null;
+SELECT '1'::agtype <> null;
+SELECT '1'::agtype < null;
+SELECT '1'::agtype > null;
+SELECT '1'::agtype <= null;
+SELECT '1'::agtype >= null;
 
 SELECT agtype_any_eq('null'::agtype, 1);
 SELECT agtype_any_ne('null'::agtype, 1);
@@ -301,6 +311,12 @@ SELECT agtype_any_lt('null'::agtype, 1);
 SELECT agtype_any_gt('null'::agtype, 1);
 SELECT agtype_any_le('null'::agtype, 1);
 SELECT agtype_any_ge('null'::agtype, 1);
+SELECT agtype_any_eq(null, '1'::agtype);
+SELECT agtype_any_ne(null, '1'::agtype);
+SELECT agtype_any_lt(null, '1'::agtype);
+SELECT agtype_any_gt(null, '1'::agtype);
+SELECT agtype_any_le(null, '1'::agtype);
+SELECT agtype_any_ge(null, '1'::agtype);
 
 --
 -- Test orderability of comparison operators =, <>, <, >, <=, >=