Using tsf_user() in a default value expression

  • 6 October 2021
  • 2 replies
  • 124 views

Userlevel 5
Badge +20

Using dbo.tsf_user() in a default value expression gives errors during execution of the source code. 

 

 

 

 

Cannot DROP FUNCTION 'tsf_user' because it is being referenced by object 'DF_prd_insert_user'.

/* Drop function tsf_user first. */

if exists (select 1 from sysobjects
where name = 'tsf_user' and (type = 'FN' or type = 'TF' or type = 'IF'))
drop function tsf_user

 

Any workaround ideas?


2 replies

Userlevel 7
Badge +23

Hi Harm,

As workaround you could do only Smart upgrades and no Full upgrades as Full upgrades will try and drop all functions. This is a bit tricky so I suggest creating a TCP ticket for this so we can make sure the use of tsf_user() inside default value expressions will go smoothly.

Userlevel 7
Badge +23

Hi Harm, 

I just tried this and it still does not result in a successful execution when chosen for a Full upgrade. That is because, during a full upgrade, the tsf_user function gets dropped and recreated. We would still like a TCP ticket for this so we can keep you updated about the resolution of this issue.

 

Edit: in Platform version 2023.1, this functionality has changed which ensures that the tsf_user function can be used.

Reply