agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Ron Mayer <rm_pg@cheapcomplexdevices.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Ron Mayer <rm_pg@cheapcomplexdevices.com>
Cc: Sebastien FLAESCH <sf@4js.com>
Cc: pgsql-general@postgresql.org
Cc: mmoncure@gmail.com
Subject: Re: INTERVAL SECOND limited to 59 seconds?
Date: Tue, 09 Jun 2009 19:49:31 -0700
Message-ID: <4A2F1F3B.1080308@cheapcomplexdevices.com> (raw)
In-Reply-To: <1256.1244588367@sss.pgh.pa.us>
References: <4A127038.3010103@4js.com>
	<4A2C0E02.9070908@cheapcomplexdevices.com>
	<17203.1244402910@sss.pgh.pa.us>
	<4A2DABF5.3070906@cheapcomplexdevices.com>
	<208.1244587299@sss.pgh.pa.us>
	<1256.1244588367@sss.pgh.pa.us>

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?




view thread (11+ messages)  latest in thread

Message-ID: <4A2F1F3B.1080308@cheapcomplexdevices.com>
Permalink:  ../../4A2F1F3B.1080308@cheapcomplexdevices.com/
Also on:    postgresql.org/message-id/4A2F1F3B.1080308@cheapcomplexdevices.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: rm_pg@cheapcomplexdevices.com, tgl@sss.pgh.pa.us, sf@4js.com, pgsql-general@postgresql.org, mmoncure@gmail.com
  Subject: Re: INTERVAL SECOND limited to 59 seconds?
  In-Reply-To: <4A2F1F3B.1080308@cheapcomplexdevices.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox