Why does rewrite rule work for page not for custom post type post?

Update: I read that a custom rewrite rule might be overridden and drop any parameter variables, when the custom rewrite rule is used on a child/parent page/post. The post my custom rewrite rule is meant for, is not a child/parent but it is part of a custom post type. Could this be causing similar rewrite issues (dropped parameter variables)?

Assign the result of current_setting(‘the_setting’) to a variable in PL/pgSQL

I have a function where I need to get a configuration parameter and assign it to a variable that I will use later in the function. The problem is that when the configuration parameter is not recognized (because it does not exist yet) the function dies. I want to evaluate if the variable was able to be assigned and if not set a null value to it.