pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Gould <daveg@sonic.net>
Cc: amutu@amutu.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13805: plpgsql execute using expression evaluate wrong
Date: Tue, 08 Dec 2015 01:36:39 -0500
Message-ID: <14234.1449556599@sss.pgh.pa.us> (raw)
In-Reply-To: <20151207220847.4da716e1@engels>
References: <20151208035444.5253.30717@wrigleys.postgresql.org>
	<20151207220847.4da716e1@engels>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

David Gould <daveg@sonic.net> writes:
> However, it does seem a little odd that the literal syntax for
> intervals accepts the '$':
> ...
> I would have expected it to raise an error. The documentation does not shed
> any light on this. Anyone?

The datetime input parser tends to consider most non-alphanumeric
characters as being insignificant except as field separators.  We could
tighten that up, but I think we should tread pretty carefully for fear of
breaking cases that used to work.  A trivial example:

regression=# select '1 mon 1 day'::interval;
  interval   
-------------
 1 mon 1 day
(1 row)

regression=# select '1 mon, 1 day'::interval;
  interval   
-------------
 1 mon 1 day
(1 row)

If we started to reject the second case, we'd likely get complaints.
But the parser doesn't see that as any different from

regression=# select '1 mon$ 1 day'::interval;
  interval   
-------------
 1 mon 1 day
(1 row)

Trying to decide which characters are legitimate noise and which
aren't seems like a tarbaby best not to get stuck to :-(

			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



view thread (6+ messages)  latest in thread

Message-ID: <14234.1449556599@sss.pgh.pa.us>
Permalink:  ../14234.1449556599@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14234.1449556599@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, daveg@sonic.net, amutu@amutu.com
  Subject: Re: BUG #13805: plpgsql execute using expression evaluate wrong
  In-Reply-To: <14234.1449556599@sss.pgh.pa.us>
  References: <20151208035444.5253.30717@wrigleys.postgresql.org> <20151207220847.4da716e1@engels> <14234.1449556599@sss.pgh.pa.us>

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

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