Bugs item #2737889, was opened at 2009-04-06 17:58
Message generated for change (Comment added) made by stmane
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2737889&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: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Vasco Visser (vascovisser)
>Assigned to: Martin Kersten (mlkersten)
Summary: rand() is not executed for every row when using alias

Initial Comment:
The RAND fuction is only executed every row when _not_ using the ALIAS, I think 
should also be executed for every row when an alias is used

Test:

create table nr (nr int);
insert into nr values (1);
insert into nr values (2);
insert into nr values (3);
insert into nr values (4);
insert into nr values (5);
insert into nr values (6);
insert into nr values (7);
insert into nr values (8);
insert into nr values (9);
insert into nr values (10);
SELECT nr, RAND() FROM nr;
SELECT nr, RAND() AS rnd FROM nr;


Output:

sql>SELECT nr, RAND() FROM nr;
+----+-------------------+
| nr | rand_single_value |
+====+===================+
|  1 |          19391021 |
|  2 |         578488884 |
|  3 |        1653577571 |
|  4 |        1840458700 |
|  5 |          73059392 |
|  6 |        1967337715 |
|  7 |         559434993 |
|  8 |        1863488420 |
|  9 |        1819496522 |
| 10 |        2012247873 |
+----+-------------------+
10 tuples
sql>SELECT nr, RAND() AS rnd FROM nr;
+----+------------+
| nr | rnd        |
+====+============+
|  1 | 2114458422 |
|  2 | 2114458422 |
|  3 | 2114458422 |
|  4 | 2114458422 |
|  5 | 2114458422 |
|  6 | 2114458422 |
|  7 | 2114458422 |
|  8 | 2114458422 |
|  9 | 2114458422 |
| 10 | 2114458422 |
+----+------------+
10 tuples



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

>Comment By: Stefan Manegold (stmane)
Date: 2009-06-07 19:55

Message:
Where exactly can I find the test?


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

Comment By: Martin Kersten (mlkersten)
Date: 2009-06-07 17:33

Message:
Seems fixed. Test file added to the suite.

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

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

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to