From 8bd1585820dd408a8562cc80104a2628f819503d Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Fri, 8 Sep 2023 06:59:50 +0000 Subject: [PATCH] Implement timestamp precisions For https://github.com/MaterializeInc/materialize/pull/21570 --- check.sh | 1 + expr.cc | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/check.sh b/check.sh index 5070459..59feeda 100755 --- a/check.sh +++ b/check.sh @@ -21,6 +21,7 @@ grep -v "cannot return complex numbers" | grep -v "unrecognized privilege type" | grep -v "statement batch size cannot exceed" | grep -v "operator does not exist" | # For list types +grep -v "does not exist" | # For roles # Refinement: grep -v "value too long for type" | grep -v "list_agg on char not yet supported" | diff --git a/expr.cc b/expr.cc index d967b36..14dcacf 100644 --- a/expr.cc +++ b/expr.cc @@ -278,16 +278,28 @@ const_expr::const_expr(prod *p, sqltype *type_constraint) expr = "TIME '01:23:45'"; else if (type->name == "timestamp") if (d6() == 1) - expr = "(TIMESTAMP '0001-01-01 00:00:00' - INTERVAL '4714 YEARS')"; + expr = "(TIMESTAMP '0001-01-01 00:00:00' - INTERVAL '4713 YEARS')"; else if (d6() == 1) expr = "(TIMESTAMP '95143-12-31 23:59:59' + INTERVAL '167 MILLENNIUM')"; + else if (d6() == 1) + expr = "(TIMESTAMP(0) '0001-01-01 00:00:00' - INTERVAL '4713 YEARS')"; + else if (d6() == 1) + expr = "(TIMESTAMP(6) '0001-01-01 00:00:00' - INTERVAL '4713 YEARS')"; + else if (d6() == 1) + expr = "TIMESTAMP(3) '2023-01-01 01:23:45'"; else expr = "TIMESTAMP '2023-01-01 01:23:45'"; else if (type->name == "timestamptz") if (d6() == 1) - expr = "(TIMESTAMPTZ '0001-01-01 00:00:00+06' - INTERVAL '4714 YEARS')"; + expr = "(TIMESTAMPTZ '0001-01-01 00:00:00+06' - INTERVAL '4713 YEARS')"; else if (d6() == 1) expr = "(TIMESTAMPTZ '95143-12-31 23:59:59+06' + INTERVAL '167 MILLENNIUM')"; + else if (d6() == 1) + expr = "(TIMESTAMPTZ(0) '0001-01-01 00:00:00+06' - INTERVAL '4713 YEARS')"; + else if (d6() == 1) + expr = "(TIMESTAMPTZ(6) '95143-12-31 23:59:59+06' + INTERVAL '167 MILLENNIUM')"; + else if (d6() == 1) + expr = "TIMESTAMPTZ(3) '2023-01-01 01:23:45+06'"; else expr = "TIMESTAMPTZ '2023-01-01 01:23:45+06'"; else if (type->name == "interval")