Skip to content

Commit

Permalink
Implement timestamp precisions
Browse files Browse the repository at this point in the history
  • Loading branch information
def- committed Sep 8, 2023
1 parent 2e12dd9 commit 8bd1585
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" |
Expand Down
16 changes: 14 additions & 2 deletions expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 8bd1585

Please sign in to comment.