Search Postgresql Archives

Re: INTERVAL SECOND limited to 59 seconds?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote:
> I wrote:
>> I'm inclined to say that these two cases are out of line with what
>> the rest of the code does and we should change them.
>  ...
> Now, all three of these cases throw "invalid input syntax" in 8.3,
> so this is not a regression from released behavior.  The question
> is does anyone think that these syntaxes should be valid?  They're
> not legal per spec, for sure, and they seem pretty ambiguous to me.

Seems to do a sane thing for all sane inputs I threw at it.

It still accepts one odd input that 8.3 rejected:
    regression=# select interval '1 1' hour;
Perhaps the additional patch below fixes that?


***************
*** 3022,3028 **** DecodeInterval(char **field, int *ftype, int nf, int range,
  						tm->tm_hour += val;
  						AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR);
  						tmask = DTK_M(HOUR);
! 						type = DTK_DAY;	/* set for next field */
  						break;

  					case DTK_DAY:
--- 3022,3029 ----
  						tm->tm_hour += val;
  						AdjustFractSeconds(fval, tm, fsec, SECS_PER_HOUR);
  						tmask = DTK_M(HOUR);
! 						if (range == (INTERVAL_MASK(DAY) | INTERVAL_MASK(HOUR)))
! 						    type = DTK_DAY;	/* set for next field */
  						break;

  					case DTK_DAY:






It also gives different answers than 8.3 for "select interval '1 1:' hour"
but I guess that's intended, right?


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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux