提交 66242d43 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improved PostgreSQL compatibility: support for RANDOM() in addition to RAND().

上级 6e3e8fb9
......@@ -2613,7 +2613,7 @@ POWER(A, B)
"
"Functions (Numeric)","RAND","
RAND( [ int ] )
{ RAND | RANDOM } ( [ int ] )
","
Calling the function without parameter returns the next a pseudo random number.
Calling it with an parameter seeds the session's random number generator.
......
......@@ -17,7 +17,8 @@ Change Log
<h1>Change Log</h1>
<h2>Next Version (unreleased)</h2>
<ul><li>There was a classloader memory leak problem because a class contained a static
<ul><li>Improved PostgreSQL compatibility: support for RANDOM() in addition to RAND().
</li><li>There was a classloader memory leak problem because a class contained a static
references to an exception (including stack trace).
</li><li>Split file system: truncating a file now deletes the parts in reverse order,
so that the file list is consistent if the process is interrupted while truncating.
......
......@@ -179,6 +179,7 @@ public class Function extends Expression implements FunctionCall {
// RAND without argument: get the next value
// RAND with one argument: seed the random generator
addFunctionNotDeterministic("RAND", RAND, VAR_ARGS, Value.DOUBLE);
addFunctionNotDeterministic("RANDOM", RAND, VAR_ARGS, Value.DOUBLE);
addFunction("ROUND", ROUND, 2, Value.DOUBLE);
addFunction("ROUNDMAGIC", ROUNDMAGIC, 1, Value.DOUBLE);
addFunction("SIGN", SIGN, 1, Value.INT);
......
......@@ -9003,16 +9003,16 @@ select power(null, null) en, power(2, 3) e8, power(16, 0.5) e4 from test;
SET AUTOCOMMIT FALSE;
> ok
select rand(1) e from test;
> E
> ------------------
> 0.7308781907032909
select rand(1) e, random() f from test;
> E F
> ------------------ -------------------
> 0.7308781907032909 0.41008081149220166
> rows: 1
select rand() e from test;
> E
> -------------------
> 0.41008081149220166
> 0.20771484130971707
> rows: 1
SET AUTOCOMMIT TRUE;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论