pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Arbitrary whitespace restrictions on range types
3+ messages / 3 participants
[nested] [flat]

* Arbitrary whitespace restrictions on range types
@ 2012-12-18 23:31  Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Josh Berkus @ 2012-12-18 23:31 UTC (permalink / raw)
  To: pgsql-bugs; +Cc: Jeff Davis <pgsql@j-davis.com>

Jeff, Hackers:

Is there a strong reason why this has to error?

postgres=# select '[,]'::TSTZRANGE
postgres-# ;
 tstzrange
-----------
 (,)
(1 row)

postgres=# select '[, ]'::TSTZRANGE;
ERROR:  invalid input syntax for type timestamp with time zone: " "
LINE 1: select '[, ]'::TSTZRANGE

--Josh

-- 
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Arbitrary whitespace restrictions on range types
@ 2012-12-19 00:06  Peter Geoghegan <peter@2ndquadrant.com>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Geoghegan @ 2012-12-19 00:06 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-bugs; Jeff Davis <pgsql@j-davis.com>

On 18 December 2012 23:31, Josh Berkus <josh@agliodbs.com> wrote:
> Jeff, Hackers:
>
> Is there a strong reason why this has to error?

Having taken a look at the range I/O routines, I surmise that it was
just easier to write range_parse() such that whitespace is included
within <string> tokens:

 * Whitespace before or after <range> is ignored.  Whitespace within a <string>
 * is taken literally and becomes part of the input string for that bound.

I think that escaping the underlying literal values for parsing is a
surprisingly difficult task, so I can see why the implementation would
shrug in this case. This behaviour may be astonishing, but that
doesn't make it a POLA violation. I don't have time to check now, but
I'm pretty sure that doing something else would break a whole bunch of
other common cases.

-- 
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Arbitrary whitespace restrictions on range types
@ 2012-12-19 01:42  Jeff Davis <pgsql@j-davis.com>
  parent: Peter Geoghegan <peter@2ndquadrant.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Jeff Davis @ 2012-12-19 01:42 UTC (permalink / raw)
  To: Peter Geoghegan <peter@2ndquadrant.com>; +Cc: Josh Berkus <josh@agliodbs.com>; pgsql-bugs

On Wed, 2012-12-19 at 00:06 +0000, Peter Geoghegan wrote:
> On 18 December 2012 23:31, Josh Berkus <josh@agliodbs.com> wrote:
> > Jeff, Hackers:
> >
> > Is there a strong reason why this has to error?
> 
> Having taken a look at the range I/O routines, I surmise that it was
> just easier to write range_parse() such that whitespace is included
> within <string> tokens:

There was some discussion about it, and the decision was made to match
record literal parsing for the sake of consistency. In a record literal,
spaces are considered to be a part of the value, so they are for range
types, as well.

Regards,
	Jeff Davis



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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-12-19 01:42 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-12-18 23:31 Arbitrary whitespace restrictions on range types Josh Berkus <josh@agliodbs.com>
2012-12-19 00:06 ` Peter Geoghegan <peter@2ndquadrant.com>
2012-12-19 01:42   ` Jeff Davis <pgsql@j-davis.com>

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