1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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.


include/mysql_com.h:
  Bug #30355: comment added
mysql-test/r/udf.result:
  Bug #30355: test case
mysql-test/t/udf.test:
  Bug #30355: test case
sql/item_func.cc:
  Bug #30355: keep const_item_cache and used_tables_cache in sync
sql/item_func.h:
  Bug #30355: 
   - a better implementation of update_used_tables()
   - keep const_item_cache and used_tables_cache in sync
sql/udf_example.c:
  Bug #30355: Wrong value for const_item fixed.
This commit is contained in:
unknown
2007-11-27 17:16:52 +02:00
parent 3d550b757d
commit 63b6516953
6 changed files with 112 additions and 6 deletions

View File

@ -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;
}