pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
is this a bug?
35+ messages / 20 participants
[nested] [flat]

* is this a bug?
@ 2000-01-24 23:34  John Henderson <jrh@is.com.fj>
  0 siblings, 0 replies; 35+ messages in thread

From: John Henderson @ 2000-01-24 23:34 UTC (permalink / raw)
  To: pgsql-general@hub.org

Hi all,
Using PostgreSQL 6.4 on BSD/OS 3.0
Is this a bug? Otherwise what am I doing wrong?

isfiji=> \q
moe:~ $ psql isfiji
Welcome to the POSTGRESQL interactive sql monitor:
  Please read the file COPYRIGHT for copyright terms of POSTGRESQL

   type \? for help on slash commands
   type \q to quit
   type \g or terminate with semicolon to execute query
 You are currently connected to the database: isfiji

isfiji=> select a.sess_id,b.sess_id,a.user_name,b.user_name,
isfiji-> a.nas_ip,b.nas_ip,a.port,b.port from startrecs a,stoprecs b
isfiji-> where a.nas_ip=b.nas_ip
isfiji-> and a.sess_id=b.sess_id
isfiji-> and a.user_name=b.user_name;
sess_id |sess_id |user_name     |user_name     | nas_ip| nas_ip|port|port
--------+--------+--------------+--------------+-------+-------+----+----
000050E2|000050E2|rchand        |rchand        |0.0.0.0|0.0.0.0|   0|   0
000050E6|000050E6|dallys        |dallys        |0.0.0.0|0.0.0.0|   0|   0
000050E8|000050E8|sana          |sana          |0.0.0.0|0.0.0.0|   0|   0
000050ED|000050ED|jdjohnson     |jdjohnson     |0.0.0.0|0.0.0.0|   0|   0
0000509F|0000509F|ritesh        |ritesh        |0.0.0.0|0.0.0.0|   0|   0
000050EE|000050EE|barbara       |barbara       |0.0.0.0|0.0.0.0|   0|   0
000050EF|000050EF|barbara       |barbara       |0.0.0.0|0.0.0.0|   0|   0
000050F0|000050F0|axis          |axis          |0.0.0.0|0.0.0.0|   0|   0
etc.....
(363 rows)

isfiji=> select a.sess_id,b.sess_id,a.user_name,b.user_name,
isfiji-> a.nas_ip,b.nas_ip,a.port,b.port from startrecs a,stoprecs b
isfiji-> where a.sess_id=b.sess_id
isfiji-> and a.user_name=b.user_name
isfiji-> and a.nas_ip=b.nas_ip;
sess_id|sess_id|user_name|user_name|nas_ip|nas_ip|port|port
-------+-------+---------+---------+------+------+----+----
(0 rows)

isfiji=>

Thanks,
John




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug
@ 2000-01-26 00:34  John Henderson <jrh@is.com.fj>
  0 siblings, 0 replies; 35+ messages in thread

From: John Henderson @ 2000-01-26 00:34 UTC (permalink / raw)
  To: pgsql-general@hub.org

Hi,
Further to my previous post it seems that it was some kind of bug as
installing version 6.5.3 made the problem go away

--quote-----------
Hi all,
Using PostgreSQL 6.4 on BSD/OS 3.0
Is this a bug? Otherwise what am I doing wrong?

isfiji=> \q
moe:~ $ psql isfiji
Welcome to the POSTGRESQL interactive sql monitor:
  Please read the file COPYRIGHT for copyright terms of POSTGRESQL

   type \? for help on slash commands
   type \q to quit
   type \g or terminate with semicolon to execute query
You are currently connected to the database: isfiji

isfiji=> select a.sess_id,b.sess_id,a.user_name,b.user_name,
isfiji-> a.nas_ip,b.nas_ip,a.port,b.port from startrecs a,stoprecs b
isfiji-> where a.nas_ip=b.nas_ip
isfiji-> and a.sess_id=b.sess_id
isfiji-> and a.user_name=b.user_name;
sess_id |sess_id |user_name     |user_name     | nas_ip| nas_ip|port|port
--------+--------+--------------+--------------+-------+-------+----+----
000050E2|000050E2|rchand        |rchand        |0.0.0.0|0.0.0.0|   0|   0
000050E6|000050E6|dallys        |dallys        |0.0.0.0|0.0.0.0|   0|   0
000050E8|000050E8|sana          |sana          |0.0.0.0|0.0.0.0|   0|   0
000050ED|000050ED|jdjohnson     |jdjohnson     |0.0.0.0|0.0.0.0|   0|   0
0000509F|0000509F|ritesh        |ritesh        |0.0.0.0|0.0.0.0|   0|   0
000050EE|000050EE|barbara       |barbara       |0.0.0.0|0.0.0.0|   0|   0
000050EF|000050EF|barbara       |barbara       |0.0.0.0|0.0.0.0|   0|   0
000050F0|000050F0|axis          |axis          |0.0.0.0|0.0.0.0|   0|   0
etc.....
(363 rows)

isfiji=> select a.sess_id,b.sess_id,a.user_name,b.user_name,
isfiji-> a.nas_ip,b.nas_ip,a.port,b.port from startrecs a,stoprecs b
isfiji-> where a.sess_id=b.sess_id
isfiji-> and a.user_name=b.user_name
isfiji-> and a.nas_ip=b.nas_ip;
sess_id|sess_id|user_name|user_name|nas_ip|nas_ip|port|port
-------+-------+---------+---------+------+------+----+----
(0 rows)

isfiji=>

Thanks,
John
--endquote-----------




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Is this a bug?
@ 2001-02-27 23:40  Limin Liu <limin@pumpkinnet.com>
  0 siblings, 2 replies; 35+ messages in thread

From: Limin Liu @ 2001-02-27 23:40 UTC (permalink / raw)
  To: pgsql-general

Hi,

Can anyone please tell me whether this is a bug or not?

I used the following SQL to create my table and view with some data.

=======================
create table tbl (no int, cnt int);
create view tbl_view as
  select no, count(cnt) as count
  from tbl
  group by no
  having count(cnt) > 2;
insert into tbl values(1, 1);
insert into tbl values(1, 2);
insert into tbl values(1, 3);
insert into tbl values(1, 4);
insert into tbl values(2, 1);
insert into tbl values(2, 2);
insert into tbl values(2, 3);
=======================

Here is soem SQL I issued; first one looks fine to me, but the second
one is weird.

=======================
db=> select * from tbl_view;
 no | count
----+-------
  1 |     4
  2 |     3
(2 rows)

db=> select * from tbl_view where count > 5;
 no | count
----+-------
  1 |     4
  2 |     3
(2 rows)

db2=>
=======================

Thanx

LM.Liu






^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug?
@ 2001-02-28 02:22  Stephan Szabo <sszabo@megazone23.bigpanda.com>
  parent: Limin Liu <limin@pumpkinnet.com>
  1 sibling, 0 replies; 35+ messages in thread

From: Stephan Szabo @ 2001-02-28 02:22 UTC (permalink / raw)
  To: Limin Liu <limin@pumpkinnet.com>; +Cc: pgsql-general


I'm going to guess you're using 7.0, right?
This should work under 7.1 (or at least your test case
does), but there were serious problems with views containing
group by in earlier versions.

On Tue, 27 Feb 2001, Limin Liu wrote:

> Hi,
> 
> Can anyone please tell me whether this is a bug or not?
> 
> I used the following SQL to create my table and view with some data.
> 
> =======================
> create table tbl (no int, cnt int);
> create view tbl_view as
>   select no, count(cnt) as count
>   from tbl
>   group by no
>   having count(cnt) > 2;
> insert into tbl values(1, 1);
> insert into tbl values(1, 2);
> insert into tbl values(1, 3);
> insert into tbl values(1, 4);
> insert into tbl values(2, 1);
> insert into tbl values(2, 2);
> insert into tbl values(2, 3);
> =======================
> 
> Here is soem SQL I issued; first one looks fine to me, but the second
> one is weird.
> 
> =======================
> db=> select * from tbl_view;
>  no | count
> ----+-------
>   1 |     4
>   2 |     3
> (2 rows)
> 
> db=> select * from tbl_view where count > 5;
>  no | count
> ----+-------
>   1 |     4
>   2 |     3
> (2 rows)




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug?
@ 2001-02-28 03:38  Ian Harding <iharding@pakrat.com>
  parent: Limin Liu <limin@pumpkinnet.com>
  1 sibling, 0 replies; 35+ messages in thread

From: Ian Harding @ 2001-02-28 03:38 UTC (permalink / raw)
  To: pgsql-general

Limin Liu wrote:

> Hi,
>
> Can anyone please tell me whether this is a bug or not?
>
> I used the following SQL to create my table and view with some data.
>
> =======================
> create table tbl (no int, cnt int);
> create view tbl_view as
>   select no, count(cnt) as count
>   from tbl
>   group by no
>   having count(cnt) > 2;
> insert into tbl values(1, 1);
> insert into tbl values(1, 2);
> insert into tbl values(1, 3);
> insert into tbl values(1, 4);
> insert into tbl values(2, 1);
> insert into tbl values(2, 2);
> insert into tbl values(2, 3);
> =======================
>
> Here is soem SQL I issued; first one looks fine to me, but the second
> one is weird.
>
> =======================
> db=> select * from tbl_view;
>  no | count
> ----+-------
>   1 |     4
>   2 |     3
> (2 rows)
>
> db=> select * from tbl_view where count > 5;
>  no | count
> ----+-------
>   1 |     4
>   2 |     3
> (2 rows)
>
> db2=>
> =======================
>
> Thanx
>
> LM.Liu

I get ERROR: Rewrite: Aggregate of views only allowed on single tables
for now

I think it may have something to do with the reserved sql keyword
'count' being used.

Ian





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: is this a bug ?
@ 2005-06-16 17:17  Jaime Casanova <systemguards@gmail.com>
  parent: Cedric BRINER <work@infomaniak.ch>
  1 sibling, 0 replies; 35+ messages in thread

From: Jaime Casanova @ 2005-06-16 17:17 UTC (permalink / raw)
  To: Cedric BRINER <work@infomaniak.ch>; +Cc: pgsql-general

On 6/16/05, Cedric BRINER <work@infomaniak.ch> wrote:
> hi,
> 
> I'm facing this problem
> 
> DROP TABLE test;
> DROP TABLE new_test;
> CREATE TABLE test (id serial NOT NULL UNIQUE, nom varchar(32));
> INSERT INTO test ("nom") values ('cedric');
> INSERT INTO test ("nom") values ('felix');
> INSERT INTO test ("nom") values ('julien');
> 
> CREATE TABLE new_test (id serial NOT NULL UNIQUE, nom varchar(32));
> INSERT INTO new_test SELECT * FROM test;
> 
Why create the table with a serial field if you're going to drop the
seq anyway just making it integer and this way you avoid your problem?

> ALTER TABLE new_test ALTER COLUMN id SET DEFAULT nextval('public.test_id_seq');
> DROP TABLE test;
> 
> ALTER TABLE new_test RENAME TO test;
> ALTER TABLE new_test_id_key RENAME TO test_id_key;
> 
> DROP SEQUENCE new_test_id_seq ;
> -- this give an error... is this normal
> 
> is this the normal behaviour ?
> 


-- 
Atentamente,
Jaime Casanova
(DBA: DataBase Aniquilator ;)



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* is this a bug ?
@ 2005-06-16 17:52  Cedric BRINER <work@infomaniak.ch>
  0 siblings, 2 replies; 35+ messages in thread

From: Cedric BRINER @ 2005-06-16 17:52 UTC (permalink / raw)
  To: pgsql-general

hi,

I'm facing this problem

DROP TABLE test;
DROP TABLE new_test;
CREATE TABLE test (id serial NOT NULL UNIQUE, nom varchar(32));
INSERT INTO test ("nom") values ('cedric');
INSERT INTO test ("nom") values ('felix');
INSERT INTO test ("nom") values ('julien');

CREATE TABLE new_test (id serial NOT NULL UNIQUE, nom varchar(32));
INSERT INTO new_test SELECT * FROM test;

ALTER TABLE new_test ALTER COLUMN id SET DEFAULT nextval('public.test_id_seq');
DROP TABLE test;

ALTER TABLE new_test RENAME TO test;
ALTER TABLE new_test_id_key RENAME TO test_id_key;

DROP SEQUENCE new_test_id_seq ;
-- this give an error... is this normal

is this the normal behaviour ?

Ced.
-- 

Cedric BRINER



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: is this a bug ?
@ 2005-06-22 11:54  Sim Zacks <sim@compulab.co.il>
  parent: Cedric BRINER <work@infomaniak.ch>
  1 sibling, 0 replies; 35+ messages in thread

From: Sim Zacks @ 2005-06-22 11:54 UTC (permalink / raw)
  To: pgsql-general

This is a normal error.
If you want to remove the sequence first you have to remove the default
value from the sequenced field.
remember serial means int4 with a default of get next serial number.

ALTER TABLE test
   ALTER COLUMN test_id_key DROP DEFAULT;

After that you could probably drop the sequence without a problem

"Cedric BRINER" <work@infomaniak.ch> wrote in message
news:20050616175239.GA23283@obs.unige.ch...
> hi,
>
> I'm facing this problem
>
> DROP TABLE test;
> DROP TABLE new_test;
> CREATE TABLE test (id serial NOT NULL UNIQUE, nom varchar(32));
> INSERT INTO test ("nom") values ('cedric');
> INSERT INTO test ("nom") values ('felix');
> INSERT INTO test ("nom") values ('julien');
>
> CREATE TABLE new_test (id serial NOT NULL UNIQUE, nom varchar(32));
> INSERT INTO new_test SELECT * FROM test;
>
> ALTER TABLE new_test ALTER COLUMN id SET DEFAULT
nextval('public.test_id_seq');
> DROP TABLE test;
>
> ALTER TABLE new_test RENAME TO test;
> ALTER TABLE new_test_id_key RENAME TO test_id_key;
>
> DROP SEQUENCE new_test_id_seq ;
> -- this give an error... is this normal
>
> is this the normal behaviour ?
>
> Ced.
> -- 
>
> Cedric BRINER
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Is this a bug?
@ 2007-07-01 18:44  Harry Jackson <harryjackson@gmail.com>
  0 siblings, 2 replies; 35+ messages in thread

From: Harry Jackson @ 2007-07-01 18:44 UTC (permalink / raw)
  To: pgsql-general

The following sql statement fails because the column "user_id" does
not exist in the users table.

=# select user_id from users WHERE  username = 'blah';
ERROR:  column "user_id" does not exist
LINE 1: select user_id from users WHERE  username = 'blah......
               ^

The following shows a valid statement where I want to delete one user
entry from the "map_users_roles" table

=# delete from map_users_roles where user_id = (select id from users
WHERE  username = 'blah');
DELETE 2

If I made a mistake and changed the "id" column to "user_id" then from
some the statement executes.

=# delete from map_users_roles where user_id = (select user_id from
users WHERE  username = 'blah');
DELETE 33631

I would have thought that the last statement would fail. Instead it
removed all the entries from the table. This is happening because I
did not qualify the column names as follows...

=# delete from map_users_roles where user_id = (select u.user_id from
users as u WHERE  username = 'blah');
ERROR:  column u.user_id does not exist
LINE 1: ...lete from map_users_roles where user_id = (select u.user_id ...

Still, this was quite a suprise to me and I would consider this a bug.

Thoughts?

-- 
Harry
http://www.uklug.co.uk
http://www.hjackson.org



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug?
@ 2007-07-01 18:52  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Harry Jackson <harryjackson@gmail.com>
  1 sibling, 0 replies; 35+ messages in thread

From: Tom Lane @ 2007-07-01 18:52 UTC (permalink / raw)
  To: Harry Jackson <harryjackson@gmail.com>; +Cc: pgsql-general

"Harry Jackson" <harryjackson@gmail.com> writes:
> If I made a mistake and changed the "id" column to "user_id" then from
> some the statement executes.

> =# delete from map_users_roles where user_id = (select user_id from
> users WHERE  username = 'blah');

This is a standard "outer reference" construction, ie, user_id refers to
the field exposed in the outer-level query if there's no match in the
inner query.  Possibly the SQL spec authors should have made it a little
harder to invoke an outer reference, but they didn't.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug?
@ 2007-07-02 08:39  Albe Laurenz <all@adv.magwien.gv.at>
  parent: Harry Jackson <harryjackson@gmail.com>
  1 sibling, 0 replies; 35+ messages in thread

From: Albe Laurenz @ 2007-07-02 08:39 UTC (permalink / raw)
  To: Harry Jackson *EXTERN* <harryjackson@gmail.com>; pgsql-general

Harry Jackson wrote:
> 
> The following sql statement fails because the column "user_id" does
> not exist in the users table.
> 
> =# select user_id from users WHERE  username = 'blah';
> ERROR:  column "user_id" does not exist
> LINE 1: select user_id from users WHERE  username = 'blah......
>                ^
[...]
>
> =# delete from map_users_roles where user_id = (select user_id from
> users WHERE  username = 'blah');
> DELETE 33631
> 
[...]
> 
> Still, this was quite a suprise to me and I would consider this a bug.
>
> Thoughts?

It is not a bug, but it is one of the best examples why it is good to
always qualify columns that I have ever seen!

Yours,
Laurenz Albe



^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Is this a bug ?
@ 2019-10-23 15:42  Ravi Krishna <sr_krishna@aol.com>
  0 siblings, 3 replies; 35+ messages in thread

From: Ravi Krishna @ 2019-10-23 15:42 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org


We noticed this bug in Redshift. It then occurred to me that this may 
very well be a PG bug since Redshift is based on PG.

Reproduced it in Version 11.5

create table bugtest (fld1 char(1)) ;

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

select count(*) from bugtest where fld1 in ('a','b','c',
                                            'd','e');  -> produces 5 as output.
So far so good.

Now check this:

select count(*) from bugtest where fld1 in ('a','b','c'
                                            'd','e');
  
Note the missing comma after 'c'. 

PG takes it a syntactically right SQL and gives 3 as output. 

In SQLServer it errors out SQL Error [102] [S0001]: Incorrect syntax near 'd'.

Can't believe this bug was never found before.  We ended up wasting lot of time to figure this out.






^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 15:47  Ron <ronljohnsonjr@gmail.com>
  parent: Ravi Krishna <sr_krishna@aol.com>
  2 siblings, 0 replies; 35+ messages in thread

From: Ron @ 2019-10-23 15:47 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 10/23/19 10:42 AM, Ravi Krishna wrote:
> We noticed this bug in Redshift. It then occurred to me that this may
> very well be a PG bug since Redshift is based on PG.
>
> Reproduced it in Version 11.5
>
> create table bugtest (fld1 char(1)) ;
>
> insert into bugtest values('a');
> insert into bugtest values('b');
> insert into bugtest values('c');
> insert into bugtest values('d');
> insert into bugtest values('e');
>
> select count(*) from bugtest where fld1 in ('a','b','c',
>                                              'd','e');  -> produces 5 as output.
> So far so good.
>
> Now check this:
>
> select count(*) from bugtest where fld1 in ('a','b','c'
>                                              'd','e');
>    
> Note the missing comma after 'c'.
>
> PG takes it a syntactically right SQL and gives 3 as output.
>
> In SQLServer it errors out SQL Error [102] [S0001]: Incorrect syntax near 'd'.
>
> Can't believe this bug was never found before.  We ended up wasting lot of time to figure this out.

Confirmed in 9.6.

postgres@haggis:~$ psql
psql (9.6.15)
Type "help" for help.

postgres=# create table bugtest (fld1 char(1)) ;
CREATE TABLE
postgres=#
postgres=# insert into bugtest values('a');
INSERT 0 1
postgres=# insert into bugtest values('b');
INSERT 0 1
postgres=# insert into bugtest values('c');
INSERT 0 1
postgres=# insert into bugtest values('d');
INSERT 0 1
postgres=# insert into bugtest values('e');
INSERT 0 1
postgres=# select count(*) from bugtest where fld1 in ('a','b','c',
postgres(# 'd','e');
  count
-------
      5
(1 row)

postgres=# select count(*) from bugtest where fld1 in ('a','b','c'
postgres(# 'd','e');
  count
-------
      3
(1 row)



-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 15:48  Gianni Ceccarelli <dakkar@thenautilus.net>
  parent: Ravi Krishna <sr_krishna@aol.com>
  2 siblings, 0 replies; 35+ messages in thread

From: Gianni Ceccarelli @ 2019-10-23 15:48 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Weird, but apparently not a bug. From
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

> Two string constants that are only separated by whitespace with at
> least one newline are concatenated and effectively treated as if the
> string had been written as one constant. For example:
>
>   SELECT 'foo'
>   'bar';
>
> is equivalent to:
>
>   SELECT 'foobar';
>
> but:
>
>   SELECT 'foo'      'bar';
>
> is not valid syntax. (This slightly bizarre behavior is specified by
> SQL; PostgreSQL is following the standard.)

-- 
	Dakkar - <Mobilis in mobile>
	GPG public key fingerprint = A071 E618 DD2C 5901 9574
	                             6FE2 40EA 9883 7519 3F88
	                    key id = 0x75193F88





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 15:51  Geoff Winkless <pgsqladmin@geoff.dj>
  parent: Ravi Krishna <sr_krishna@aol.com>
  2 siblings, 2 replies; 35+ messages in thread

From: Geoff Winkless @ 2019-10-23 15:51 UTC (permalink / raw)
  To: Ravi Krishna <sr_krishna@aol.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Wed, 23 Oct 2019 at 16:42, Ravi Krishna <sr_krishna@aol.com> wrote:

> select count(*) from bugtest where fld1 in ('a','b','c'
>                                             'd','e');
>
> Note the missing comma after 'c'.
>
> PG takes it a syntactically right SQL and gives 3 as output.
>
> In SQLServer it errors out SQL Error [102] [S0001]: Incorrect syntax near 'd'.
>
> Can't believe this bug was never found before.  We ended up wasting lot of time to figure this out.

Simplify:

select 'a'
db-# 'b';
 ?column?
----------
 ab
(1 row)

This is not a bug.

https://www.postgresql.org/docs/9.2/sql-syntax-lexical.html

Two string constants that are only separated by whitespace with at
least one newline are concatenated and effectively treated as if the
string had been written as one constant.

Geoff





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 15:53  Ravi Krishna <sr_krishna@aol.com>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  1 sibling, 1 reply; 35+ messages in thread

From: Ravi Krishna @ 2019-10-23 15:53 UTC (permalink / raw)
  To: Geoff Winkless <pgsqladmin@geoff.dj>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

> 
> Simplify:
> 
> select 'a'
> db-# 'b';
> ?column?
> ----------
> ab
> (1 row)
> 
> This is not a bug.
> 
> https://www.postgresql.org/docs/9.2/sql-syntax-lexical.html
> 
> Two string constants that are only separated by whitespace with at
> least one newline are concatenated and effectively treated as if the
> string had been written as one constant.
> 
> Geoff

Shouldn't the output be 4 in that case since it is looking for('a','b','cd','e') and it should find all but cd.
                                  




^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 15:55  Ron <ronljohnsonjr@gmail.com>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  1 sibling, 4 replies; 35+ messages in thread

From: Ron @ 2019-10-23 15:55 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 10/23/19 10:51 AM, Geoff Winkless wrote:
> On Wed, 23 Oct 2019 at 16:42, Ravi Krishna <sr_krishna@aol.com> wrote:
>
>> select count(*) from bugtest where fld1 in ('a','b','c'
>>                                              'd','e');
>>
>> Note the missing comma after 'c'.
>>
>> PG takes it a syntactically right SQL and gives 3 as output.
>>
>> In SQLServer it errors out SQL Error [102] [S0001]: Incorrect syntax near 'd'.
>>
>> Can't believe this bug was never found before.  We ended up wasting lot of time to figure this out.
> Simplify:
>
> select 'a'
> db-# 'b';
>   ?column?
> ----------
>   ab
> (1 row)
>
> This is not a bug.
>
> https://www.postgresql.org/docs/9.2/sql-syntax-lexical.html
>
> Two string constants that are only separated by whitespace with at
> least one newline are concatenated and effectively treated as if the
> string had been written as one constant.

Then -- since the 'e' is separated from 'd' by a comma, the result should be 
"4", not "3".

No doubt: it's a bug, no matter what the Pg devs say.

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:00  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Ron <ronljohnsonjr@gmail.com>
  3 siblings, 1 reply; 35+ messages in thread

From: Tom Lane @ 2019-10-23 16:00 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

Ron <ronljohnsonjr@gmail.com> writes:
> On 10/23/19 10:51 AM, Geoff Winkless wrote:
>> Two string constants that are only separated by whitespace with at
>> least one newline are concatenated and effectively treated as if the
>> string had been written as one constant.

> Then -- since the 'e' is separated from 'd' by a comma, the result should be 
> "4", not "3".

No, because your command is equivalent to

    select count(*) from bugtest where fld1 in ('a','b','cd','e');

'cd' does not match any of the table rows, so 3 is the correct answer.

> No doubt: it's a bug, no matter what the Pg devs say.

Complain to the SQL standards committee, not us.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:00  Fabio Ugo Venchiarutti <f.venchiarutti@ocado.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  3 siblings, 0 replies; 35+ messages in thread

From: Fabio Ugo Venchiarutti @ 2019-10-23 16:00 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 23/10/2019 16:55, Ron wrote:
> On 10/23/19 10:51 AM, Geoff Winkless wrote:
>> On Wed, 23 Oct 2019 at 16:42, Ravi Krishna <sr_krishna@aol.com> wrote:
>>
>>> select count(*) from bugtest where fld1 in ('a','b','c'
>>>                                              'd','e');
>>>
>>> Note the missing comma after 'c'.
>>>
>>> PG takes it a syntactically right SQL and gives 3 as output.
>>>
>>> In SQLServer it errors out SQL Error [102] [S0001]: Incorrect syntax 
>>> near 'd'.
>>>
>>> Can't believe this bug was never found before.  We ended up wasting 
>>> lot of time to figure this out.
>> Simplify:
>>
>> select 'a'
>> db-# 'b';
>>   ?column?
>> ----------
>>   ab
>> (1 row)
>>
>> This is not a bug.
>>
>> https://www.postgresql.org/docs/9.2/sql-syntax-lexical.html
>>
>> Two string constants that are only separated by whitespace with at
>> least one newline are concatenated and effectively treated as if the
>> string had been written as one constant.
> 
> Then -- since the 'e' is separated from 'd' by a comma, the result 
> should be "4", not "3".
> 
> No doubt: it's a bug, no matter what the Pg devs say.
> 


Does any record in your test table contain the concatenated 'cd' in 
"fld1"? If not, it's working as per specification & documentation.


I can agree that this sounds like one of those idiosyncratic parts of 
the ANSI specification that exist only for compatibility with some 
ancient practice, but this behaviour is documented.


BTW, can parser behavior be affected by settings this early?


A GUC setting disabling this madness would make sense IMHO...




-- 
Regards

Fabio Ugo Venchiarutti
OSPCFC Network Engineering Dpt.
Ocado Technology

-- 


Notice: 
This email is confidential and may contain copyright material of 
members of the Ocado Group. Opinions and views expressed in this message 
may not necessarily reflect the opinions and views of the members of the 
Ocado Group.

If you are not the intended recipient, please notify us 
immediately and delete all copies of this message. Please note that it is 
your responsibility to scan this message for viruses.

References to the 
"Ocado Group" are to Ocado Group plc (registered in England and Wales with 
number 7098618) and its subsidiary undertakings (as that expression is 
defined in the Companies Act 2006) from time to time. The registered office 
of Ocado Group plc is Buildings One & Two, Trident Place, Mosquito Way, 
Hatfield, Hertfordshire, AL10 9UL.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:00  John W Higgins <wishdev@gmail.com>
  parent: Ravi Krishna <sr_krishna@aol.com>
  0 siblings, 0 replies; 35+ messages in thread

From: John W Higgins @ 2019-10-23 16:00 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Wed, Oct 23, 2019 at 8:56 AM Ravi Krishna <sr_krishna@aol.com> wrote:

> >
> > Simplify:
> >
> > select 'a'
> > db-# 'b';
> > ?column?
> > ----------
> > ab
> > (1 row)
> >
> > This is not a bug.
> >
> > https://www.postgresql.org/docs/9.2/sql-syntax-lexical.html
> >
> > Two string constants that are only separated by whitespace with at
> > least one newline are concatenated and effectively treated as if the
> > string had been written as one constant.
> >
> > Geoff
>
> Shouldn't the output be 4 in that case since it is looking
> for('a','b','cd','e') and it should find all but cd.
>
>
And that means there are 3 options on the table = a, b, and e - where is
the 4th item?

cd is not in the table so it cannot be found.

John

^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:03  Geoff Winkless <pgsqladmin@geoff.dj>
  parent: Ron <ronljohnsonjr@gmail.com>
  3 siblings, 1 reply; 35+ messages in thread

From: Geoff Winkless @ 2019-10-23 16:03 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Wed, 23 Oct 2019 at 16:55, Ron <ronljohnsonjr@gmail.com> wrote:
> Then -- since the 'e' is separated from 'd' by a comma, the result should be
> "4", not "3".
>
> No doubt: it's a bug, no matter what the Pg devs say.

I'm confused why you consider that to be true. The count is checking
for columns containing the strings 'a', 'b', 'cd' or 'e'. There is not
one with 'cd', so the correct result is 3.

Geoff





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:08  Ron <ronljohnsonjr@gmail.com>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  0 siblings, 0 replies; 35+ messages in thread

From: Ron @ 2019-10-23 16:08 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 10/23/19 11:03 AM, Geoff Winkless wrote:
> On Wed, 23 Oct 2019 at 16:55, Ron <ronljohnsonjr@gmail.com> wrote:
>> Then -- since the 'e' is separated from 'd' by a comma, the result should be
>> "4", not "3".
>>
>> No doubt: it's a bug, no matter what the Pg devs say.
> I'm confused why you consider that to be true. The count is checking
> for columns containing the strings 'a', 'b', 'cd' or 'e'. There is not
> one with 'cd', so the correct result is 3.

That's my mistake.

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:09  Ron <ronljohnsonjr@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 35+ messages in thread

From: Ron @ 2019-10-23 16:09 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 10/23/19 11:00 AM, Tom Lane wrote:
> Ron <ronljohnsonjr@gmail.com> writes:
>> On 10/23/19 10:51 AM, Geoff Winkless wrote:
>>> Two string constants that are only separated by whitespace with at
>>> least one newline are concatenated and effectively treated as if the
>>> string had been written as one constant.
>> Then -- since the 'e' is separated from 'd' by a comma, the result should be
>> "4", not "3".
> No, because your command is equivalent to
>
>      select count(*) from bugtest where fld1 in ('a','b','cd','e');
>
> 'cd' does not match any of the table rows, so 3 is the correct answer.

Yes, that's my mistake.

>> No doubt: it's a bug, no matter what the Pg devs say.
> Complain to the SQL standards committee, not us.

As much as I hate to say it, MSFT was right to ignore this bug in the standard.


-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:20  Geoff Winkless <pgsqladmin@geoff.dj>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 4 replies; 35+ messages in thread

From: Geoff Winkless @ 2019-10-23 16:20 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Wed, 23 Oct 2019 at 17:09, Ron <ronljohnsonjr@gmail.com> wrote:

> As much as I hate to say it, MSFT was right to ignore this bug in the standard.

Standards are standards for a reason. It is almost never correct to
deliberately ignore them. If you don't like them, then revise the
standard.

Historically Microsoft ignored standards either because they
misunderstood them or because they wanted to lock in their customers,
not for any reasons of altruism.

For what it's worth, I can see a value to having

SELECT 'this is quite a long string'
               'which I've joined together '
               'across multiple lines';

although the advantage of it vs using a concat operator is slim.

Geoff





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:27  Ron <ronljohnsonjr@gmail.com>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  3 siblings, 1 reply; 35+ messages in thread

From: Ron @ 2019-10-23 16:27 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 10/23/19 11:20 AM, Geoff Winkless wrote:
> On Wed, 23 Oct 2019 at 17:09, Ron <ronljohnsonjr@gmail.com> wrote:
>
>> As much as I hate to say it, MSFT was right to ignore this bug in the standard.
> Standards are standards for a reason. It is almost never correct to
> deliberately ignore them. If you don't like them, then revise the
> standard.
>
> Historically Microsoft ignored standards either because they
> misunderstood them or because they wanted to lock in their customers,
> not for any reasons of altruism.
>
> For what it's worth, I can see a value to having
>
> SELECT 'this is quite a long string'
>                 'which I've joined together '
>                 'across multiple lines';
>
> although the advantage of it vs using a concat operator is slim.

There is no advantage to using it vs using a concat operator, and all 
disadvantage.

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:27  Geoff Winkless <pgsqladmin@geoff.dj>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  3 siblings, 1 reply; 35+ messages in thread

From: Geoff Winkless @ 2019-10-23 16:27 UTC (permalink / raw)
  To: Geoff Winkless <pgsqladmin@geoff.dj>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On Wed, 23 Oct 2019 at 17:20, Geoff Winkless <pgsqladmin@geoff.dj> wrote:
> For what it's worth, I can see a value to having
>
> SELECT 'this is quite a long string'
>                'which I've joined together '
>                'across multiple lines';
>
> although the advantage of it vs using a concat operator is slim.

As an aside, Postgres isn't the only DB to follow the standard here.

mysql> select 'hello'
    -> ' there';
+-------------+
| hello       |
+-------------+
| hello there |
+-------------+

Geoff





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:30  Ron <ronljohnsonjr@gmail.com>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  0 siblings, 2 replies; 35+ messages in thread

From: Ron @ 2019-10-23 16:30 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 10/23/19 11:27 AM, Geoff Winkless wrote:
> On Wed, 23 Oct 2019 at 17:20, Geoff Winkless <pgsqladmin@geoff.dj> wrote:
>> For what it's worth, I can see a value to having
>>
>> SELECT 'this is quite a long string'
>>                 'which I've joined together '
>>                 'across multiple lines';
>>
>> although the advantage of it vs using a concat operator is slim.
> As an aside, Postgres isn't the only DB to follow the standard here.
>
> mysql> select 'hello'
>      -> ' there';
> +-------------+
> | hello       |
> +-------------+
> | hello there |
> +-------------+

This is the kind of weird stuff that we mocked mysql for.

This too would have been roundly mocked if discovered in mysql:

postgres=# select to_date('2018150X','YYYYMMDD');
   to_date
------------
  2019-03-03
(1 row)


-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:40  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  1 sibling, 0 replies; 35+ messages in thread

From: Adrian Klaver @ 2019-10-23 16:40 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 10/23/19 9:30 AM, Ron wrote:
> On 10/23/19 11:27 AM, Geoff Winkless wrote:
>> On Wed, 23 Oct 2019 at 17:20, Geoff Winkless <pgsqladmin@geoff.dj> wrote:
>>> For what it's worth, I can see a value to having
>>>
>>> SELECT 'this is quite a long string'
>>>                 'which I've joined together '
>>>                 'across multiple lines';
>>>
>>> although the advantage of it vs using a concat operator is slim.
>> As an aside, Postgres isn't the only DB to follow the standard here.
>>
>> mysql> select 'hello'
>>      -> ' there';
>> +-------------+
>> | hello       |
>> +-------------+
>> | hello there |
>> +-------------+
> 
> This is the kind of weird stuff that we mocked mysql for.
> 
> This too would have been roundly mocked if discovered in mysql:
> 
> postgres=# select to_date('2018150X','YYYYMMDD');
>    to_date
> ------------
>   2019-03-03
> (1 row)
> 
> 

As of v10 it does not work in Postgres either:

test_(postgres)# select version(); 
 
 

                                                           version 
 
 

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

  PostgreSQL 11.5 on x86_64-pc-linux-gnu, compiled by gcc (SUSE Linux) 
7.4.1 20190424 [gcc-7-branch revision 270538], 64-bit 
 

(1 row)

test_(postgres)# select to_date('2018150X','YYYYMMDD');
ERROR:  date/time field value out of range: "2018150X"



-- 
Adrian Klaver
adrian.klaver@aklaver.com





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 16:51  Fabio Ugo Venchiarutti <f.venchiarutti@ocado.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  1 sibling, 0 replies; 35+ messages in thread

From: Fabio Ugo Venchiarutti @ 2019-10-23 16:51 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 23/10/2019 17:30, Ron wrote:
> On 10/23/19 11:27 AM, Geoff Winkless wrote:
>> On Wed, 23 Oct 2019 at 17:20, Geoff Winkless <pgsqladmin@geoff.dj> wrote:
>>> For what it's worth, I can see a value to having
>>>
>>> SELECT 'this is quite a long string'
>>>                 'which I've joined together '
>>>                 'across multiple lines';
>>>
>>> although the advantage of it vs using a concat operator is slim.
>> As an aside, Postgres isn't the only DB to follow the standard here.
>>
>> mysql> select 'hello'
>>      -> ' there';
>> +-------------+
>> | hello       |
>> +-------------+
>> | hello there |
>> +-------------+
> 
> This is the kind of weird stuff that we mocked mysql for.
> 
> This too would have been roundly mocked if discovered in mysql:
> 
> postgres=# select to_date('2018150X','YYYYMMDD');
>    to_date
> ------------
>   2019-03-03
> (1 row)
> 
> 


The main difference being that we mocked MySQL because it BROKE the 
standard requirements in bespoke, arguably lazy/stupid/dangerous ways 
(and often undocumented as a result).


You ran into a gotcha of the SQL specification; in your shoes I'd 
instead appreciate the fact that the PG maintainers went out of their 
way and documented this spec weirdness as such in their own project when 
they could have just went "look into the specification for oddities".


MySQL silently truncated your overflowing string for years without as 
much as a warning, by default. In my book that broke specification, rule 
of least surprise, data safety and a lot more.



-- 
Regards

Fabio Ugo Venchiarutti
OSPCFC Network Engineering Dpt.
Ocado Technology

-- 


Notice: 
This email is confidential and may contain copyright material of 
members of the Ocado Group. Opinions and views expressed in this message 
may not necessarily reflect the opinions and views of the members of the 
Ocado Group.

If you are not the intended recipient, please notify us 
immediately and delete all copies of this message. Please note that it is 
your responsibility to scan this message for viruses.

References to the 
"Ocado Group" are to Ocado Group plc (registered in England and Wales with 
number 7098618) and its subsidiary undertakings (as that expression is 
defined in the Companies Act 2006) from time to time. The registered office 
of Ocado Group plc is Buildings One & Two, Trident Place, Mosquito Way, 
Hatfield, Hertfordshire, AL10 9UL.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 18:55  Ron <ronljohnsonjr@gmail.com>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  3 siblings, 0 replies; 35+ messages in thread

From: Ron @ 2019-10-23 18:55 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 10/23/19 11:20 AM, Geoff Winkless wrote:
> On Wed, 23 Oct 2019 at 17:09, Ron <ronljohnsonjr@gmail.com> wrote:
>
>> As much as I hate to say it, MSFT was right to ignore this bug in the standard.
> Standards are standards for a reason. It is almost never correct to
> deliberately ignore them. If you don't like them, then revise the
> standard.
>
> Historically Microsoft ignored standards either because they
> misunderstood them or because they wanted to lock in their customers,
> not for any reasons of altruism.
>
> For what it's worth, I can see a value to having
>
> SELECT 'this is quite a long string'
>                 'which I've joined together '
>                 'across multiple lines';
>
> although the advantage of it vs using a concat operator is slim.

It just occurred to me that this is probably something that COBOL does (it's 
been 30 years, so I might be mistaken) and so that's how it slipped into the 
SQL standard.

-- 
Angular momentum makes the world go 'round.





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 19:03  Peter J. Holzer <hjp-pgsql@hjp.at>
  parent: Geoff Winkless <pgsqladmin@geoff.dj>
  3 siblings, 1 reply; 35+ messages in thread

From: Peter J. Holzer @ 2019-10-23 19:03 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 2019-10-23 17:20:07 +0100, Geoff Winkless wrote:
> For what it's worth, I can see a value to having
> 
> SELECT 'this is quite a long string'
>                'which I've joined together '
>                'across multiple lines';
> 
> although the advantage of it vs using a concat operator is slim.

True. However, concatenation of string literals by juxtaposition isn't
specific to SQL. Two other well known languages where this works (even
without a newline) are C and Python.

        hp

-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp@hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/;

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 19:14  Gaetano Mendola <mendola@gmail.com>
  parent: Ron <ronljohnsonjr@gmail.com>
  3 siblings, 0 replies; 35+ messages in thread

From: Gaetano Mendola @ 2019-10-23 19:14 UTC (permalink / raw)
  To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

On Wed, Oct 23, 2019 at 5:55 PM Ron <ronljohnsonjr@gmail.com> wrote:
> No doubt: it's a bug, no matter what the Pg devs say.

select 'a'
'b'  = 'ab'

this is what SQL mandates

You should submit a complain to SQL guys

-- 
cpp-today.blogspot.com





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 19:15  Gaetano Mendola <mendola@gmail.com>
  parent: Peter J. Holzer <hjp-pgsql@hjp.at>
  0 siblings, 1 reply; 35+ messages in thread

From: Gaetano Mendola @ 2019-10-23 19:15 UTC (permalink / raw)
  To: Peter J. Holzer <hjp-pgsql@hjp.at>; +Cc: pgsql-general@lists.postgresql.org

On Wed, Oct 23, 2019 at 9:03 PM Peter J. Holzer <hjp-pgsql@hjp.at> wrote:
>
> On 2019-10-23 17:20:07 +0100, Geoff Winkless wrote:
> > For what it's worth, I can see a value to having
> >
> > SELECT 'this is quite a long string'
> >                'which I've joined together '
> >                'across multiple lines';
> >
> > although the advantage of it vs using a concat operator is slim.
>
> True. However, concatenation of string literals by juxtaposition isn't
> specific to SQL. Two other well known languages where this works (even
> without a newline) are C and Python.

And C++ as well





^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-23 19:51  Ravi Krishna <sr_krishna@aol.com>
  parent: Gaetano Mendola <mendola@gmail.com>
  0 siblings, 0 replies; 35+ messages in thread

From: Ravi Krishna @ 2019-10-23 19:51 UTC (permalink / raw)
  To: ; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

So reading responses from all, here is a SQL test I did on few RDBMS:


select 'John'
           'Doe' as rrr
from information_schema.tables
limit 1;

PG output

rrr
---
JohnDoe

Oracle and mysql gave same output as PG with no error

SQLServer: Syntax error near 'as'.
DB2 gave same error as SQLServer.






^ permalink  raw  reply  [nested|flat] 35+ messages in thread

* Re: Is this a bug ?
@ 2019-10-25 05:01  George Neuner <gneuner2@comcast.net>
  parent: Ron <ronljohnsonjr@gmail.com>
  0 siblings, 0 replies; 35+ messages in thread

From: George Neuner @ 2019-10-25 05:01 UTC (permalink / raw)
  To: pgsql-general

On Wed, 23 Oct 2019 11:27:12 -0500, Ron <ronljohnsonjr@gmail.com>
wrote:

>On 10/23/19 11:20 AM, Geoff Winkless wrote:
>> On Wed, 23 Oct 2019 at 17:09, Ron <ronljohnsonjr@gmail.com> wrote:
>>
>>> As much as I hate to say it, MSFT was right to ignore this bug in the standard.
>> Standards are standards for a reason. It is almost never correct to
>> deliberately ignore them. If you don't like them, then revise the
>> standard.
>>
>> Historically Microsoft ignored standards either because they
>> misunderstood them or because they wanted to lock in their customers,
>> not for any reasons of altruism.
>>
>> For what it's worth, I can see a value to having
>>
>> SELECT 'this is quite a long string'
>>                 'which I've joined together '
>>                 'across multiple lines';
>>
>> although the advantage of it vs using a concat operator is slim.
>
>There is no advantage to using it vs using a concat operator, and all 
>disadvantage.

It WAS an advantage querying interactively on 80 character text mode
screens, and when SQL was embedded (directly) into programs written in
other languages.

Regardless of how recent the latest standard - SQL still has many ...
warts really, but I will be charitable and call them "vestiges" ... of
its roots as a 1970s language.

YMMV,
George






^ permalink  raw  reply  [nested|flat] 35+ messages in thread


end of thread, other threads:[~2019-10-25 05:01 UTC | newest]

Thread overview: 35+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-01-24 23:34 is this a bug? John Henderson <jrh@is.com.fj>
2000-01-26 00:34 Re: Is this a bug John Henderson <jrh@is.com.fj>
2001-02-27 23:40 Is this a bug? Limin Liu <limin@pumpkinnet.com>
2001-02-28 02:22 ` Re: Is this a bug? Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-02-28 03:38 ` Re: Is this a bug? Ian Harding <iharding@pakrat.com>
2005-06-16 17:52 is this a bug ? Cedric BRINER <work@infomaniak.ch>
2005-06-16 17:17 ` Re: is this a bug ? Jaime Casanova <systemguards@gmail.com>
2005-06-22 11:54 ` Re: is this a bug ? Sim Zacks <sim@compulab.co.il>
2007-07-01 18:44 Is this a bug? Harry Jackson <harryjackson@gmail.com>
2007-07-01 18:52 ` Re: Is this a bug? Tom Lane <tgl@sss.pgh.pa.us>
2007-07-02 08:39 ` Re: Is this a bug? Albe Laurenz <all@adv.magwien.gv.at>
2019-10-23 15:42 Is this a bug ? Ravi Krishna <sr_krishna@aol.com>
2019-10-23 15:47 ` Re: Is this a bug ? Ron <ronljohnsonjr@gmail.com>
2019-10-23 15:48 ` Re: Is this a bug ? Gianni Ceccarelli <dakkar@thenautilus.net>
2019-10-23 15:51 ` Re: Is this a bug ? Geoff Winkless <pgsqladmin@geoff.dj>
2019-10-23 15:53   ` Re: Is this a bug ? Ravi Krishna <sr_krishna@aol.com>
2019-10-23 16:00     ` Re: Is this a bug ? John W Higgins <wishdev@gmail.com>
2019-10-23 15:55   ` Re: Is this a bug ? Ron <ronljohnsonjr@gmail.com>
2019-10-23 16:00     ` Re: Is this a bug ? Tom Lane <tgl@sss.pgh.pa.us>
2019-10-23 16:09       ` Re: Is this a bug ? Ron <ronljohnsonjr@gmail.com>
2019-10-23 16:20         ` Re: Is this a bug ? Geoff Winkless <pgsqladmin@geoff.dj>
2019-10-23 16:27           ` Re: Is this a bug ? Ron <ronljohnsonjr@gmail.com>
2019-10-25 05:01             ` Re: Is this a bug ? George Neuner <gneuner2@comcast.net>
2019-10-23 16:27           ` Re: Is this a bug ? Geoff Winkless <pgsqladmin@geoff.dj>
2019-10-23 16:30             ` Re: Is this a bug ? Ron <ronljohnsonjr@gmail.com>
2019-10-23 16:40               ` Re: Is this a bug ? Adrian Klaver <adrian.klaver@aklaver.com>
2019-10-23 16:51               ` Re: Is this a bug ? Fabio Ugo Venchiarutti <f.venchiarutti@ocado.com>
2019-10-23 18:55           ` Re: Is this a bug ? Ron <ronljohnsonjr@gmail.com>
2019-10-23 19:03           ` Re: Is this a bug ? Peter J. Holzer <hjp-pgsql@hjp.at>
2019-10-23 19:15             ` Re: Is this a bug ? Gaetano Mendola <mendola@gmail.com>
2019-10-23 19:51               ` Re: Is this a bug ? Ravi Krishna <sr_krishna@aol.com>
2019-10-23 16:00     ` Re: Is this a bug ? Fabio Ugo Venchiarutti <f.venchiarutti@ocado.com>
2019-10-23 16:03     ` Re: Is this a bug ? Geoff Winkless <pgsqladmin@geoff.dj>
2019-10-23 16:08       ` Re: Is this a bug ? Ron <ronljohnsonjr@gmail.com>
2019-10-23 19:14     ` Re: Is this a bug ? Gaetano Mendola <mendola@gmail.com>

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