36 #define DCURRENT "current"
38 #define INVALID "invalid"
39 #define EARLY "-infinity"
40 #define LATE "infinity"
43 #define TOMORROW "tomorrow"
44 #define YESTERDAY "yesterday"
47 #define DMICROSEC "usecond"
48 #define DMILLISEC "msecond"
49 #define DSECOND "second"
50 #define DMINUTE "minute"
54 #define DMONTH "month"
55 #define DQUARTER "quarter"
57 #define DDECADE "decade"
58 #define DCENTURY "century"
59 #define DMILLENNIUM "millennium"
62 #define DTIMEZONE "timezone"
103 #define MILLISECOND 13
104 #define MICROSECOND 14
111 #define ABS_BEFORE 20
120 #define MILLENNIUM 27
124 #define UNKNOWN_FIELD 31
149 #define DTK_SPECIAL 6
154 #define DTK_YESTERDAY 13
156 #define DTK_TOMORROW 15
160 #define DTK_SECOND 18
161 #define DTK_MINUTE 19
166 #define DTK_QUARTER 24
168 #define DTK_DECADE 26
169 #define DTK_CENTURY 27
170 #define DTK_MILLENNIUM 28
171 #define DTK_MILLISEC 29
172 #define DTK_MICROSEC 30
173 #define DTK_JULIAN 31
177 #define DTK_TZ_HOUR 34
178 #define DTK_TZ_MINUTE 35
179 #define DTK_ISOYEAR 36
180 #define DTK_ISODOW 37
187 #define DTK_M(t) (0x01 << (t))
190 #define DTK_ALL_SECS_M (DTK_M(SECOND) | DTK_M(MILLISECOND) | DTK_M(MICROSECOND))
191 #define DTK_DATE_M (DTK_M(YEAR) | DTK_M(MONTH) | DTK_M(DAY))
192 #define DTK_TIME_M (DTK_M(HOUR) | DTK_M(MINUTE) | DTK_ALL_SECS_M)
200 #define MAXDATELEN 128
202 #define MAXDATEFIELDS 25
237 #define FMODULO(t,q,u) \
239 (q) = (((t) < 0) ? ceil((t) / (u)) : floor((t) / (u))); \
240 if ((q) != 0) (t) -= rint((q) * (u)); \
248 #define TMODULO(t,q,u) \
251 if ((q) != 0) (t) -= ((q) * (u)); \
271 #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
282 #define DTERR_BAD_FORMAT (-1)
283 #define DTERR_FIELD_OVERFLOW (-2)
284 #define DTERR_MD_FIELD_OVERFLOW (-3)
285 #define DTERR_INTERVAL_OVERFLOW (-4)
286 #define DTERR_TZDISP_OVERFLOW (-5)
287 #define DTERR_BAD_TIMEZONE (-6)
288 #define DTERR_BAD_ZONE_ABBREV (-7)
299 #define TZNAME_FIXED_OFFSET 0
300 #define TZNAME_DYNTZ 1
301 #define TZNAME_ZONE 2
306 extern void j2date(
int jd,
int *year,
int *month,
int *day);
307 extern int date2j(
int year,
int month,
int day);
309 extern int ParseDateTime(
const char *timestr,
char *workbuf,
size_t buflen,
310 char **field,
int *ftype,
311 int maxfields,
int *numfields);
325 const char *
str,
const char *datatype,
326 struct Node *escontext);
331 pg_tz *tzp,
int *isdst);
339 extern int ValidateDate(
int fmask,
bool isjulian,
bool is2digits,
bool bc,
343 int *ftype,
int *offset,
pg_tz **tz,
346 extern int DecodeUnits(
int field,
const char *lowtoken,
int *
val);
352 int *offset,
pg_tz **tz);
365 struct Node *escontext);
#define FLEXIBLE_ARRAY_MEMBER
pg_tz * DecodeTimezoneNameToTz(const char *tzname)
int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr, pg_tz *tzp, int *isdst)
PGDLLIMPORT const char *const months[]
void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl)
int DecodeUnits(int field, const char *lowtoken, int *val)
int DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra)
int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields)
bool AdjustTimestampForTypmod(Timestamp *time, int32 typmod, struct Node *escontext)
void EncodeInterval(struct pg_itm *itm, int style, char *str)
struct DateTimeErrorExtra DateTimeErrorExtra
int DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp)
int DecodeInterval(char **field, int *ftype, int nf, int range, int *dtype, struct pg_itm_in *itm_in)
PGDLLIMPORT const int day_tab[2][13]
void EncodeSpecialTimestamp(Timestamp dt, char *str)
bool CheckDateTokenTables(void)
int DecodeTimezoneAbbrev(int field, const char *lowtoken, int *ftype, int *offset, pg_tz **tz, DateTimeErrorExtra *extra)
void EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str)
int DecodeISO8601Interval(char *str, int *dtype, struct pg_itm_in *itm_in)
int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, struct pg_tm *tm)
struct TimeZoneAbbrevTable TimeZoneAbbrevTable
int DecodeSpecial(int field, const char *lowtoken, int *val)
void j2date(int jd, int *year, int *month, int *day)
void GetCurrentDateTime(struct pg_tm *tm)
PGDLLIMPORT const char *const days[]
TimeZoneAbbrevTable * ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n)
void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str)
int DecodeTimezone(const char *str, int *tzp)
void EncodeDateOnly(struct pg_tm *tm, int style, char *str)
struct DynamicZoneAbbrev DynamicZoneAbbrev
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra)
int date2j(int year, int month, int day)
void GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp)
void DateTimeParseError(int dterr, DateTimeErrorExtra *extra, const char *str, const char *datatype, struct Node *escontext)
int DecodeTimezoneName(const char *tzname, int *offset, pg_tz **tz)
struct Node * TemporalSimplify(int32 max_precis, struct Node *node)
int DecodeTimezoneAbbrevPrefix(const char *str, int *offset, pg_tz **tz)
int DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
datetkn abbrevs[FLEXIBLE_ARRAY_MEMBER]