Bugs item #2737889, was opened at 2009-04-06 17:58
Message generated for change (Tracker Item Submitted) made by vascovisser
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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Vasco Visser (vascovisser)
Assigned to: Niels Nes (nielsnes)
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



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

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

------------------------------------------------------------------------------
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to