New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow hiding source code of procedures and triggers in FB 3 [CORE4544] #4862
Comments
Commented by: @dyemanov Solution for v3 Beta 2 and beyond: re-allow setting RDB$*_SOURCE to NULL (while protecting all other modifications). |
Modified by: @dyemanovstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 3.0 Beta 2 [ 10586 ] assignee: Dmitry Yemanov [ dimitr ] |
Commented by: @pavel-zotov Engine raises exception when 'UPDATE ... SET RDB$...SOURCE = NULL' tries to clear source of some object (proc/trigger) *again*, i.e. when this field already is NULL. This will borrow anyone who already has some units with NULL value in source and has added several units after it: one need to explicitly enumerate these units that has to be cleared. === begin of script === recreate table test(id int primary key, x int); recreate sequence g; set term ^; create or alter function fn_test1 returns int as create or alter trigger trg_test_1 active before insert on test as set term ;^ set blob all; ------------------------------------------------------ [ 1 ] -------------------------------------------------- select rdb$procedure_name, rdb$procedure_source from rdb$procedures where rdb$system_flag is distinct from 1; select rdb$function_name, rdb$function_source from rdb$functions where rdb$system_flag is distinct from 1; select rdb$trigger_name, rdb$trigger_source from rdb$triggers where rdb$system_flag is distinct from 1; set count on; update rdb$procedures set rdb$procedure_source = null update rdb$functions set rdb$function_source = null update rdb$triggers set rdb$trigger_source = null commit; set echo off; set term ^; create or alter procedure sp_test2 as create or alter function fn_test2 returns int as create or alter trigger trg_test_2 active after insert or update or delete on test as set term ;^ set count on; ------------------------------------------------------ [ 2 ] -------------------------------------------------- update rdb$procedures set rdb$procedure_source = null update rdb$functions set rdb$function_source = null update rdb$triggers set rdb$trigger_source = null commit; set count off; select rdb$procedure_name, rdb$procedure_source from rdb$procedures where rdb$system_flag is distinct from 1; select rdb$function_name, rdb$function_source from rdb$functions where rdb$system_flag is distinct from 1; select rdb$trigger_name, rdb$trigger_source from rdb$triggers where rdb$system_flag is distinct from 1; === end of script === Statements 'update ... set rdb$source = null' in block marked as [ 1 ] will execute without exceptions.
|
Commented by: @pavel-zotov PS. Of course, we can add in every UPDATE statement additional line like "and rdb$procedure_source is not null" but IMO it engine should allow to avoid this. |
Commented by: @pavel-zotov PPS. update rdb$packages set rdb$package_body_source = null Not implemented yet ? |
Commented by: @dyemanov NULL->NULL changes are intentionally prohibited. The problem, AFAIR, is that it's impossible to distinguish between e.g. SET RDB$PROCEDURE_SOURCE = NULL and SET RDB$PROCEDURE_NAME = RDB$PROCEDURE_NAME or any other kind of dummy update. This may cause confusion as some direct system table updates (that do not actually change anything) become allowed, e.g.: update rdb$relations set rdb$system_flag = 0 would succeed for records already having rdb$system_flag = 0 and fail for others, and this is impossible to predict without knowing what's actually stored inside rdb$system_flag. Given that the SOURCE->NULL changes are allowed only temporarily, until something better is implemented, and given that the issue can be worked around using the WHERE clause, I tend to leave everything as is. |
Commented by: @dyemanov SET RDB$PACKAGE_BODY_SOURCE = NULL is allowed now. |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @WarmBooter
Votes: 2
As discussed in fb-devel, there should be a way to hide the source code of procedures and triggers in FB 3, either by allowing the long-time-used "hack" of nulling the source code in the system tables, or implementing an official way.
The text was updated successfully, but these errors were encountered: