Thread: Adding // comments (ANSI??)...

Adding // comments (ANSI??)...

From
Sean Chittenden
Date:
I just had a friend over at EDS ask me if PostgreSQL supported //
comments.  It didn't, so I put together a patch for them so that they
could retain compatiblity across the databases they work on.

I didn't think much of it until I took a gander at the crash-me page
on mysql.com and I couldn't find a single vendor that supports //
comments, but it did list // as an ANSI supported comment.  ::shrug::
I don't have a copy of the spec, so someone more knowledgable in that
area will have to speak to this or whether or not support for // is
even wantd, but, here's the patch and regression tests.  -sc

--
Sean Chittenden

Attachment

Re: Adding // comments (ANSI??)...

From
"Christopher Kings-Lynne"
Date:
As far as I'm aware, MySQL is the only database that supports '//' as a
comment, and they made it up out of whole cloth...

ANSI _C_ perhaps...

Chris

> -----Original Message-----
> From: pgsql-patches-owner@postgresql.org
> [mailto:pgsql-patches-owner@postgresql.org]On Behalf Of Sean Chittenden
> Sent: Wednesday, 5 February 2003 7:22 AM
> To: pgsql-patches@postgresql.org
> Subject: [PATCHES] Adding // comments (ANSI??)...
>
>
> I just had a friend over at EDS ask me if PostgreSQL supported //
> comments.  It didn't, so I put together a patch for them so that they
> could retain compatiblity across the databases they work on.
>
> I didn't think much of it until I took a gander at the crash-me page
> on mysql.com and I couldn't find a single vendor that supports //
> comments, but it did list // as an ANSI supported comment.  ::shrug::
> I don't have a copy of the spec, so someone more knowledgable in that
> area will have to speak to this or whether or not support for // is
> even wantd, but, here's the patch and regression tests.  -sc
>
> --
> Sean Chittenden
>


Re: Adding // comments (ANSI??)...

From
Sean Chittenden
Date:
> > I just had a friend over at EDS ask me if PostgreSQL supported //
> > comments.  It didn't, so I put together a patch for them so that they
> > could retain compatiblity across the databases they work on.
> >
> > I didn't think much of it until I took a gander at the crash-me page
> > on mysql.com and I couldn't find a single vendor that supports //
> > comments, but it did list // as an ANSI supported comment.  ::shrug::
> > I don't have a copy of the spec, so someone more knowledgable in that
> > area will have to speak to this or whether or not support for // is
> > even wantd, but, here's the patch and regression tests.  -sc
>
> As far as I'm aware, MySQL is the only database that supports '//'
> as a comment, and they made it up out of whole cloth...
>
> ANSI _C_ perhaps...

MySQL doesn't support //, unless you meant #.

http://www.mysql.com/information/crash-me.php
http://www.mysql.com/doc/en/Comments.html
http://www.mysql.com/doc/en/ANSI_diff_comments.html


Hrm, well, sybase, Microsoft, and a thing called "AceDB" do, but I
haven't seen high nor low of // being actually referenced as an ANSI
sanctioned comment style anywhere.  I guess that's just for the
archives or the C++/Java impared.  ::shrug::

http://manuals.sybase.com/onlinebooks/group-aw/awg0800e/dbrfen8/@Generic__BookTextView/7074
http://www.microsoft.com/mspress/books/sampchap/4076a.asp
http://www.acedb.org/Cornell/syntax.html

-sc

--
Sean Chittenden

Re: Adding // comments (ANSI??)...

From
Neil Conway
Date:
On Tue, 2003-02-04 at 21:03, Christopher Kings-Lynne wrote:
> As far as I'm aware, MySQL is the only database that supports '//' as a
> comment, and they made it up out of whole cloth...

Just to confirm that, my copy of the SQL 2003 draft, section 5.2, says:

<comment> ::=
       <simple comment>
    |  <bracketed comment>

<simple comment> ::=
    <simple comment introducer> [ <comment characters>...] <newline>

<simple comment introducer> ::=
    <minus sign><minus sign>[<minus sign>...]

(and <bracketed comment> is a C-style /* ... */ pair, which I've omitted
for brevity).

I'm not sure where the evidence for the "ANSI standard" claim comes
from, but AFAICS "// comments" are not part of the SQL standard, at any
rate.

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC




Re: Adding // comments (ANSI??)...

From
Tom Lane
Date:
Sean Chittenden <sean@chittenden.org> writes:
> I didn't think much of it until I took a gander at the crash-me page
> on mysql.com and I couldn't find a single vendor that supports //
> comments, but it did list // as an ANSI supported comment.  ::shrug::

MySQL seem to have only a very weak grasp on the notion of "spec
compliance" ;-).  // is most definitely not a comment in the SQL spec.

Furthermore, it's a legal operator name in Postgres.

            regards, tom lane

Re: Adding // comments (ANSI??)...

From
Sean Chittenden
Date:
> > I didn't think much of it until I took a gander at the crash-me
> > page on mysql.com and I couldn't find a single vendor that
> > supports // comments, but it did list // as an ANSI supported
> > comment.  ::shrug::
>
> MySQL seem to have only a very weak grasp on the notion of "spec
> compliance" ;-).  // is most definitely not a comment in the SQL
> spec.

At best a weak notion of spec compliance.  You should read about the
use of '--' as a comment and why '--' has to have a space after it in
order for it to be a valid comment: I found it highly amusing.  :)

Anyway, Neil, thanks for looking that up: I don't have a copy of the
standard and thought it was a tad strange to see it listed as an ANSI
comment (assuming they meant ANSI SQL and not ANSI C99), especially
since I couldn't find _any_ references suggesting // as a valid SQL
token.  :)

-sc

--
Sean Chittenden