public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Sérgio Saquetim <[email protected]>
Cc: [email protected]
Subject: Re: Lexical Structure - String Constants
Date: Tue, 17 Jun 2014 00:12:34 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CACwnGOdA3MZADTbT0hNXJFuge+fwF7=hCCMu2+9r2-0Dbard0g@mail.gmail.com>
References: <CACwnGOdA3MZADTbT0hNXJFuge+fwF7=hCCMu2+9r2-0Dbard0g@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-docs>

=?UTF-8?Q?S=C3=A9rgio_Saquetim?= <[email protected]> writes:
> So line style comments (--) are accepted between segments but not C style
> block comments (/* */). Do you think this difference in behavior should me
> mentioned in the docs?

Hm, interesting.  It looks to me like modern versions of the SQL spec
require either -- or /* ... */ style comments to be allowed between
segments of a quoted literal.  This is pretty bad taste in language
design, if you ask me, but that's what it seems to say.  I think that
our current lexer rules date from before the SQL standard even had
/* ... */ style comments, which is why the lexer isn't taking it.

> I've also noticed that in section 4.1.2.6, the following statement: "At
> least one digit must follow the exponent marker (e), if one is present."

> As I've understood the statement, I think it says that the following
> instruction should not be valid because the exponent marker is not followed
> by at least one digit, but the expression is successfully evaluated:

> postgres=# SELECT 10e;
>  e
> ----
>  10
> (1 row)

"10e" is not a valid number, just like the manual says.  But "10" is a
valid number, and "e" is a valid column alias, so this is equivalent
to "SELECT 10 AS e".  There's no requirement for white space between
adjacent tokens, if the tokens couldn't validly be run together into
one token.

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



view thread (3+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Lexical Structure - String Constants
  In-Reply-To: <[email protected]>

* 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