Skip to content

Commit 885f7d5

Browse files
committed
start needs to be at least 1 hour in the future
Signed-off-by: Dorin Hogea <dhogea@bloomberg.net>
1 parent 50a1182 commit 885f7d5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sqlite/src/comdb2build.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7892,6 +7892,16 @@ void comdb2CreateTimePartition(Parse* pParse, Token* period, Token* retention,
78927892
(int64_t*)&partition->u.tpt.start)) {
78937893
free_ddl_context(pParse);
78947894
}
7895+
7896+
/* if retroactively partitioning, make sure the start is one day in the future */
7897+
if (retro) {
7898+
time_t crtTime = time(NULL);
7899+
int startTime = partition->u.tpt.start;
7900+
if (crtTime >= (startTime - 3600)) {
7901+
setError(pParse, SQLITE_ABORT, "Please choose a start time 1 hour in the future");
7902+
return;
7903+
}
7904+
}
78957905
}
78967906

78977907
/**

0 commit comments

Comments
 (0)