1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Enforce the restriction that 'unixepoch' only works as the first modifier

after the time-value.  This has been documented since 2004, but has never
actually been enforced before.  Also add new test cases for date/time
functions with evidence marks.

FossilOrigin-Name: 64fa9e8c87179211cec248e6dfd7578502e6e969a19e91a4f0e21ed9b972a6bc
This commit is contained in:
drh
2022-01-27 13:52:01 +00:00
parent a5c9a70757
commit 4b51e8bd68
4 changed files with 159 additions and 8 deletions

View File

@@ -697,7 +697,7 @@ static int parseModifier(
** SQLite (0..5373484.5) then the result will be NULL.
*/
if( sqlite3_stricmp(z, "julianday")==0 ){
if( idx>1 ) return 1;
if( idx>1 ) return 1; /* IMP: R-31176-64601 */
if( p->validJD && p->rawS ){
rc = 0;
p->rawS = 0;
@@ -728,6 +728,7 @@ static int parseModifier(
** seconds since 1970. Convert to a real julian day number.
*/
if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){
if( idx>1 ) return 1; /* IMP: R-49255-55373 */
r = p->s*1000.0 + 210866760000000.0;
if( r>=0.0 && r<464269060800000.0 ){
clearYMD_HMS_TZ(p);