Port Bug Report: missing commas in IN( ) ignored; bracketing entries ignored

Поиск
Список
Период
Сортировка
Искать

Port Bug Report: missing commas in IN( ) ignored; bracketing entries ignored

От:
Unprivileged user <nobody>
Дата:

============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Diab Jerius
Your email address      : djerius@cfa.harvard.edu

Category                : runtime: front-end
Severity                : non-critical

Summary: missing commas in IN( ) ignored; bracketing entries ignored

System Configuration
--------------------
  Operating System   : Solaris 2.6

  PostgreSQL version : 6.4.2

  Compiler used      : Sunpro cc

Hardware:
---------
	

Versions of other tools:
------------------------
gmake 3.71
flex 2.5.4

--------------------------------------------------------------------------

Problem Description:
--------------------
In psql, if a list of entries in an IN ( ) statement is
split across several lines, missing commas are not flagged as errors,
but the entries immediately before and after the missing comma
are ignored

--------------------------------------------------------------------------

Test Case:
----------
The following sql shows the problem.  Note the missing comma between
the 'c' and 'd' lines in the IN( ) clause.  The query
should return no rows.

drop table test;

create table test ( s text );

insert into test values ( 'a' );
insert into test values ( 'b' );
insert into test values ( 'c' );
insert into test values ( 'd' );
insert into test values ( 'e' );



select 
    s
from
    test
where
    s not in ( 
	'a',
	'b',
	'c'
	'd',
	'e'
    )
order by s
;


--------------------------------------------------------------------------

Solution:
---------


--------------------------------------------------------------------------

Re: [PORTS] Port Bug Report: missing commas in IN( ) ignored; bracketing entries ignored

От:
Bruce Momjian <maillist@candle.pha.pa.us>
Дата:
> Problem Description:
> --------------------
> In psql, if a list of entries in an IN ( ) statement is
> split across several lines, missing commas are not flagged as errors,
> but the entries immediately before and after the missing comma
> are ignored
> 
> --------------------------------------------------------------------------
> 
> Test Case:
> ----------
> The following sql shows the problem.  Note the missing comma between
> the 'c' and 'd' lines in the IN( ) clause.  The query
> should return no rows.
> 
> drop table test;
> 
> create table test ( s text );
> 
> insert into test values ( 'a' );
> insert into test values ( 'b' );
> insert into test values ( 'c' );
> insert into test values ( 'd' );
> insert into test values ( 'e' );
> 
> 
> 
> select 
>     s
> from
>     test
> where
>     s not in ( 
> 	'a',
> 	'b',
> 	'c'
> 	'd',
> 	'e'
>     )
> order by s
> ;

That is the strangest parser problem I have seen in quite some time.

Does anyone want to guess on a cause?

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: [PORTS] Port Bug Report: missing commas in IN( ) ignored; bracketing entries ignored

От:
Thomas Lockhart <lockhart@alumni.caltech.edu>
Дата:
> > In psql, if a list of entries in an IN ( ) statement is
> > split across several lines, missing commas are not 
> > flagged as errors, but the entries immediately before 
> > and after the missing comma are ignored
> Does anyone want to guess on a cause?

*raises hand* I know! I know!!

You are seeing the allowed, accepted, and required string
concatenation feature of SQL92:

postgres=> select 
postgres-> 'hi'
postgres-> ' there';
?column?
--------
hi there
(1 row)

:)

                         - Tom

-- 
Thomas Lockhart				lockhart@alumni.caltech.edu
South Pasadena, California

Re: [PORTS] Port Bug Report: missing commas in IN( ) ignored; bracketing entries ignored

От:
Bruce Momjian <maillist@candle.pha.pa.us>
Дата:
> > > In psql, if a list of entries in an IN ( ) statement is
> > > split across several lines, missing commas are not 
> > > flagged as errors, but the entries immediately before 
> > > and after the missing comma are ignored
> > Does anyone want to guess on a cause?
> 
> *raises hand* I know! I know!!
> 
> You are seeing the allowed, accepted, and required string
> concatenation feature of SQL92:
> 
> postgres=> select 
> postgres-> 'hi'
> postgres-> ' there';
> ?column?
> --------
> hi there
> (1 row)

Wow, that is interesting, and would have been quite hard to find the
cause.  Thanks.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
FAQ