REGEXP_REPLACE

Extensibility
Enthusiast

REGEXP_REPLACE

Hi,

   I am not able to view the source code for regexp_replace using show function

when i give SHOW FUNCTION TD_SYSFNLIB.REGEXP_REPLACE i get error stating that 'cannot find find best fit function'.But this function is present in TD_SYSFNLIB Database with no requesttext.

I need the source code because I need to use it in other system where this function is not present.Can I take the source code and use CREATE FUNCTION to implement the same?Please reply

Thanks,

Vijayshankar

9 REPLIES
Senior Apprentice

Re: REGEXP_REPLACE

This is an overloaded function, you need to use SHOW SPECIFIC FUNCTION with the exact name, but then you'll encounter another error indicating show is not supported for fastpath functions.

There is no way to copy this function to another TD system unless it's part of that release. I assume you try to copy it from TD14 to a previous release :-)

Dieter

Enthusiast

Re: REGEXP_REPLACE

Hi Dieter,

            Thanks a lot.I am using 13.0.0.16 version.Can you please tell me why there is no source code for this Function in Requesttext in dbc.tables.

Thanks,

Vijayshankar

Senior Apprentice

Re: REGEXP_REPLACE

There's no source code because it's shipped precompiled (probably in some .so files).

Only TD engeneering can install functions in td_sysfnlib.

If you had the source code it would not work on TD13, as those fastpath functions are called differently (without a stack) from user UDFs.

Of course you could wrap a C-implementation of REGEXP_REPLACE in a TD UDF, but execution will be slower.

Dieter

Enthusiast

Re: REGEXP_REPLACE

Hi Dieter,

      Thanks for the reply.Could you please tell me how to wrap C-implementation of REGEXP_REPLACE in TD UDF.Where can I get C version of REGEXP_REPLACE.

Thanks,

Vijayshankar

Senior Apprentice

Re: REGEXP_REPLACE

Are you a C programmer? I'm not, i can still read C programs (and understand at least some of it), but i never dared to write a UDF.

A common C-library for Regular Expressions is PCRE, for an experienced C-programmer it should be easy to implement as UDF. An example (for MySQL) is found at www.mysqludf.org/lib_mysqludf_preg/

I don't know if MySQL's UDF implementation is similar to TD.

Dieter

Enthusiast

Re: REGEXP_REPLACE

Hi Dieter,

        I am not a C programmer.Thanks for the link.I will see what I can do.

Thanks,

Vijayshankar

Enthusiast

Re: REGEXP_REPLACE

Hi Diether,

What is the database - TD_SYSFNLIB. What does it contain (UDF ?)?

One user is asking a Ececute function access to this DB. However, i noticed that even the DBC doesn't have execute function access on this. Can we give this access to a user ?

Could you please some inputs as i cant anything on internet on this.           

-Thanks !       

Teradata Employee

Re: REGEXP_REPLACE

The TD_SYSFNLIB database is the repository of Teradata Domain UDFs. These are supplied by Teradata and generally all users have execute access to them. They provide addtional functionality for users. I'm surprised that all users don't have access in your case. These are meant for users so I don't see any reason not to grant access.

Senior Apprentice

Re: REGEXP_REPLACE

The functions in td_sysfnlib are like built-in functions, you don't need any access right to use them and the right can't be revoked, too.

Dieter