Hi,

I guess it would make sense to allow to override some (only some) built-in
functions. Not the ones that are used internally ("cast", "ifnull", "zero",
"array_get", "table", "currval", "set", "current_timestamp", "casewhen",
"dateadd",...), but at least the ones that are not problematic, such as
"trunc".

Patches are welcome! To implement this feature, I guess we would need to
add canOverride to the class FunctionInfo, and then change the Parser class.

Regards,
Thomas



On Wed, Mar 13, 2013 at 3:49 PM, Marco Brade <[email protected]> wrote:

> Hello
>
> we use h2 as test database as an oracle emulation.
> With version 1.3.167 an new alias was introduced trunc as alias of
> truncate.
>
> This alias prevents us to create our own alias trunc which is an method in
> oracle. Its also not possible to remove this alias.
>
> Please get the following sql work again right now the first drop does not
> work and the create throws an exception.
>
> drop ALIAS trunc;
> commit;
> CREATE ALIAS trunc as '
> import java.text.*;
> import java.util.*;
> @CODE
> java.util.Date trunc(java.sql.Timestamp timeStamp)  throws Exception {
>         Calendar c = Calendar.getInstance();
>         c.setTime(new Date(timeStamp.getTime()));
>         c.set(Calendar.HOUR, 0);
>         c.set(Calendar.MINUTE, 0);
>         c.set(Calendar.SECOND, 0);
>         c.set(Calendar.MILLISECOND, 0);
>         return  c.getTime();
> } ';
>
>
> Or if database is in oracle mode remove the alias.
>
> // Marco
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to