Unanswered: How to pass variables from PSQL command line to a function ?
I'd like to declare a variable on the psql command line, e.g. -v log_level=DEBUG, then be able to access this variable from within a utility function that is used by my code to log messages to a table. The logging level will determine whether or not to log the message. I've tried the various formats I've found on the internet, e.g.
CREATE OR REPLACE FUNCTION add_log_msg( v_proc_name varchar, v_msg_log_level varchar(16), v_log_msg varchar)
RETURNS void AS