Connection-terminating error when inlining scalar UDF in a view in 2019 CTP2.2
When we installed SQL Server 2019 CTP 2.2 on a testing server and began running a test workload, we immediately saw connection-terminating errors every time a particular view was accessed.
We narrowed the issue down to a view that uses a scalar UDF, and that scalar UDF has a call to the USER_NAME() function. The error does not happen when a sysadmin is logged in, but does happen for a login with dbo privileges on the database.
The attached file contains a simplified, standalone reproduction of the issue (submitted as .txt because the system says .sql files are not allowed).