Tom Lane wrote:
BTW, I just noticed that CVS HEAD has a bug in reading negative SQL-spec
literals:
regression=# select interval '-2008-10'; regression=# select interval '-0000-10';
Surely the latter must mean -10 months.  This is orthogonal to the
current patch ...

Perhaps the below patch fixes that?
(though line numbers probably won't match since this was based off
of the patched version)



*** a/src/backend/utils/adt/datetime.c
--- b/src/backend/utils/adt/datetime.c
***************
*** 2879,2885 **** DecodeInterval(char **field, int *ftype, int nf, int range,
                                        if (*cp != '\0')
                                                return DTERR_BAD_FORMAT;
                                        type = DTK_MONTH;
!                                       if (val < 0)
                                                val2 = -val2;
                                        val = val * MONTHS_PER_YEAR + val2;
                                        fval = 0;
--- 2879,2885 ----
                                        if (*cp != '\0')
                                                return DTERR_BAD_FORMAT;
                                        type = DTK_MONTH;
!                                       if (field[0][0] == '-')
                                                val2 = -val2;
                                        val = val * MONTHS_PER_YEAR + val2;
                                        fval = 0;
[5]lt:/home/ramayer/proj/pg/postgresql/src/backend/utils/adt%


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to