In Postgres 15, how can we define constants that pertain to business logic rather than db configuration settings? I'd like to define them within SQL scripts rather than passed through the psql -v MY_CONSTANT=123
command & I don't care if they persist only for the session.
In prior versions I quietly got away with the following syntax:
SET MY_CONSTANT TO 123; -- declared
CALL my_func(:MY_CONSTANT); -- used
Which from the documentation seems to be intended for modifying known db config settings & explains why I am encountering issues like this:
my_script.sql:2: ERROR: unrecognized configuration parameter "my_constant"