Bugs item #2658243, was opened at 2009-03-03 19:06
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2658243&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL/Core
Group: SQL "stable"
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Roberto Cornacchia (cornuz)
Assigned to: Niels Nes (nielsnes)
Summary: SQL: INSERT INTO + ORDER BY

Initial Comment:
I'm not completely sure what SQL standard says here:

when we have

INSERT INTO mytable
SELECT .... ORDER BY a

are mytable's tuples supposed to be stored in a's order?
I would expect so, but on the other hand I wouldn't be surprised if the 
standard didn't enforce that.

Anyway, currently the INSERT INTO seems to ignore the ORDER BY. Little test 
follows:


create table unsorted (n int);
insert into unsorted values (2);
insert into unsorted values (1);
insert into unsorted values (4);
insert into unsorted values (3);
insert into unsorted values (5);


create table sorted (n int);
insert into sorted
select * from unsorted
order by n;

sql>select * from unsorted;
+---+
| n |
+===+
| 2 |
| 1 |
| 4 |
| 3 |
| 5 |
+---+
5 tuples
sql>select * from sorted;
+---+
| n |
+===+
| 2 |
| 1 |
| 4 |
| 3 |
| 5 |
+---+
5 tuples

To be really sure table "sorted" is not stored as sorted on "n":

sql>debug select * from sorted;
mdb>#    mdb.start();
mdb>
mdb>#    user.s3_1();
mdb>
mdb>#barrier _49 := language.dataflow();
mdb>
mdb>#    _1 := sql.bind("sys","sorted","n",0);
mdb>
mdb>#    _6 := sql.bind("sys","sorted","n",2);
mdb>info _1
Show info for 1458
#-----------------------------------------#
# h                     t                 # name
# str                   str               # type
#-----------------------------------------#
...
[ "tsorted",              "0"             ]
...



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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2658243&group_id=56967

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to