snippetsqlMinor
How to delete global variables set in PostgreSQL
Viewed 0 times
postgresqlglobaldeletevariableshowset
Problem
I had Set a global variable using SET bc.xyz=value
but now I am not able to delete it.
Please help me in it.
but now I am not able to delete it.
Please help me in it.
Solution
This is not really a variable, but a “placeholder parameter”, and once you have set it, there is no way to “undefine” it for the lifetime of the database session.
Using it as a variable is actually abusing the concept, which is to allow specifying extension parameters in
You could set the parameter to an empty value (or some other special value) to indicate that you want to unset it.
Alternatively, consider storing such variables in a temporary table, which will automatically be deleted as soon as the database session is done.
Using it as a variable is actually abusing the concept, which is to allow specifying extension parameters in
postgresql.conf even before the extension is loaded.You could set the parameter to an empty value (or some other special value) to indicate that you want to unset it.
Alternatively, consider storing such variables in a temporary table, which will automatically be deleted as soon as the database session is done.
Context
StackExchange Database Administrators Q#257207, answer score: 3
Revisions (0)
No revisions yet.