Configuration Setting Functions
Configuration setting functions are used to query and modify runtime configuration parameters.
current_setting(setting_name)
Description: Current setting value.
Return type: text.
Note: current_setting is used to query the current value of setting_name. It is equivalent to the SQL statement SHOW. For example:
1 2 3 4 5 6 |
SELECT current_setting('datestyle'); current_setting ----------------- ISO, MDY (1 row) |
read_global_var(global_setting_name)
Description: Reads the current value of a global variable.
Return type: text.
Note: read_global_var is used to query the current value of global_setting_name. It is equivalent to the SQL statement SHOW.
Example:
1 2 3 4 5 6 |
SET my.var = 1000; SELECT read_global_var('my.var'); read_global_var ----------------- 1000 (1 row) |

global_setting_name indicates a variable of the my.var type. The name contains a decimal point and the left and right of the decimal point are not empty. Variables of this type are called global variables.
Global variables can only be set by running the SET command and are visible to all users. The gs_guc, ALTER DATABASE dbname SET paraname TO value, and ALTER USER username SET paraname TO value setting methods are not supported.
set_config(setting_name, new_value, is_local)
Description: Sets the parameter and returns a new value.
Return type: text.
Note: set_config sets setting_name to new_value. If is_local is true, the new value applies only to the current transaction. If you want the new value to be applied to the current session, you can use false, which is equivalent to the SQL statement SET. For example:
1 2 3 4 5 6 |
SELECT set_config('log_statement_stats', 'off', false); set_config ------------ off (1 row) |

If the GUC parameter behavior_compat_options is set to DISABLE_SET_GLOBAL_VAR_ON_DATANODE, you cannot use this function to set global variables on DNs.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot