diff options
author | gkodinov/kgeorge@magare.gmz <> | 2007-11-27 17:16:52 +0200 |
---|---|---|
committer | gkodinov/kgeorge@magare.gmz <> | 2007-11-27 17:16:52 +0200 |
commit | 8c3d5135baeba8a418ded32a649ae6ca3f75be3e (patch) | |
tree | 85a53cbb4741c611e7582ad13a198792eced866f /sql/udf_example.c | |
parent | 07b83736024d153f16dcf0e8a47daf38f63c7b8a (diff) | |
download | mariadb-git-8c3d5135baeba8a418ded32a649ae6ca3f75be3e.tar.gz |
Bug #30355: Incorrect ordering of UDF results
There's currently no way of knowing the determinicity of an UDF.
And the optimizer and the sequence() UDFs were making wrong
assumptions about what the is_const member means.
Plus there was no implementation of update_system_tables()
causing the optimizer to overwrite the information returned by
the <udf>_init function.
Fixed by equating the assumptions about the semantics of
is_const and providing a implementation of update_used_tables().
Added a TODO item for the UDF API change needed to make a better
implementation.
Diffstat (limited to 'sql/udf_example.c')
-rw-r--r-- | sql/udf_example.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sql/udf_example.c b/sql/udf_example.c index df3a69755ad..4ca6133da03 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -648,13 +648,11 @@ my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message) return 1; } bzero(initid->ptr,sizeof(longlong)); - /* - Fool MySQL to think that this function is a constant - This will ensure that MySQL only evalutes the function - when the rows are sent to the client and not before any ORDER BY - clauses + /* + sequence() is a non-deterministic function : it has different value + even if called with the same arguments. */ - initid->const_item=1; + initid->const_item=0; return 0; } |