pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Lockhart <lockhart@alumni.caltech.edu>
Cc: Axel at ansonic <goddyna@ansonic.com.au>
Cc: pgsql-interfaces@postgreSQL.org, "Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>
Cc: blackw@sfu.ca
Subject: Re: [INTERFACES] Bug in parser?
Date: Tue, 08 Feb 2000 01:42:13 -0500
Message-ID: <405.949992133@sss.pgh.pa.us> (raw)
In-Reply-To: <389FB27B.1F9702BD@alumni.caltech.edu>
References: <NABBLEOMMPNHHMBPOBPFIENAFFAA.goddyna@ansonic.com.au>
	<27734.949981876@sss.pgh.pa.us>
	<389FB27B.1F9702BD@alumni.caltech.edu>

Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> Pretty sure that the SQL92 rules for the "string across lines" is more
> restrictive than just allowing spaces between double quotes; you
> actually need something close to a line break.
>
> select * from "T1" "A1";
>
> would do horrible things if I interpret your suggestion correctly.

No, because we're talking about string literals (single quotes) not
double-quoted names.  Is there harm in interpreting
	select 'a string' ' literal';
as
	select 'a string literal';
?  And if so, why does it suddenly become OK if I write it as
	select 'a string'
	       ' literal';

The SQL92 spec isn't particularly transparent about this, but if I am
looking at the right syntax items, we have

         <character string literal> ::=
              [ <introducer><character set specification> ]
              <quote> [ <character representation>... ] <quote>
                [ { <separator>... <quote> [ <character representation>... ] <quote> }... ]

         <separator> ::= { <comment> | <space> | <newline> }...

which sure as heck looks like you can write either newline or just
plain space between 'a string' and ' literal' and get the same answer.

A couple other items:

* I see why xqdouble has to be separate from xqcat; the former
produces a single quote in the represented string, the latter doesn't.
So xqcat must at least be defined as
	xqcat	{quote}{space}{space}*{quote}
to allow it to be distinguished from xqdouble.

* I see that the spec allows comments between segments of a string
literal.  This works in current code:

regression=# select 'a string' -- zzz
regression-# ' literal';
     ?column?
------------------
 a string literal
(1 row)

but I'm durned if I see where that behavior is implemented.
Do you?

			regards, tom lane



view thread (12+ messages)  latest in thread

Message-ID: <405.949992133@sss.pgh.pa.us>
Permalink:  ../405.949992133@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/405.949992133@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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, lockhart@alumni.caltech.edu, goddyna@ansonic.com.au, reedstrm@wallace.ece.rice.edu, blackw@sfu.ca
  Subject: Re: [INTERFACES] Bug in parser?
  In-Reply-To: <405.949992133@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