Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W6Qoh-0004N4-M6 for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Jan 2014 20:23:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W6Qoh-00060j-1c for pgsql-bugs@arkaria.postgresql.org; Thu, 23 Jan 2014 20:23:59 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W6Qog-00060d-AJ for pgsql-bugs@postgresql.org; Thu, 23 Jan 2014 20:23:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W6Qod-0007pV-My for pgsql-bugs@postgresql.org; Thu, 23 Jan 2014 20:23:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s0NKNsa6008725; Thu, 23 Jan 2014 15:23:54 -0500 From: Tom Lane To: Sergei.Agalakov@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8939: Cast to range type fails due to whitespaces in the text string In-reply-to: <20140123172703.26702.69411@wrigleys.postgresql.org> References: <20140123172703.26702.69411@wrigleys.postgresql.org> Comments: In-reply-to Sergei.Agalakov@gmail.com message dated "Thu, 23 Jan 2014 17:27:03 +0000" Date: Thu, 23 Jan 2014 15:23:54 -0500 Message-ID: <8724.1390508634@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Sergei.Agalakov@gmail.com writes: > According to documentation > http://www.postgresql.org/docs/9.3/interactive/rangetypes.html paragraph > 8.17.5. Range Input/Output > "Whitespace is allowed before and after the range value, but any whitespace > between the parentheses or brackets is taken as part of the lower or upper > bound value. (Depending on the element type, it might or might not be > significant.)" > The real behavior is different for bounded and unbounded ranges: > SELECT '[10,)'::int4range; -- OK > SELECT '[10, )'::int4range; -- Fails > SELECT '[10,12 )'::int4range; -- OK > SELECT '(, 10]'::int4range; -- OK > SELECT '(,10 )'::int4range; -- OK > SELECT '( ,10)'::int4range; -- Fails > SELECT '( 8,10)'::int4range; -- OK I see no bug here. If you're omitting a value, you can't put some random whitespace there instead. The documentation seems clear enough about that to me. > I would expect that for range types where white spaces can't be significant > for evaluating elements they would be trimmed before evaluating a SQL > statement with casting to a range type. Currently an implementation of > casting to range types is too peaky to the exact syntax of the text string. Don't insert any made-up whitespace. What's so hard about that? regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs