You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to request a new feature in Atlas HCL to support the following SQL syntax within function definitions:
-- Create "pg_try_advisory_lock_timeout" functionCREATEFUNCTION "public"."pg_try_advisory_lock_timeout"("key"text, "timeout"text)
RETURNS booleanSET lock_timeout FROM CURRENT
LANGUAGE plpgsql
AS $$
BEGIN
EXECUTE format('SET SESSION lock_timeout TO %L;', timeout);
PERFORM pg_advisory_lock(hashtext(key));
RETURN true;
EXCEPTION
WHEN lock_not_available OR deadlock_detected THEN RETURN false;
END
$$;
In this example, the function temporarily sets the advisory lock timeout and restores the previous value upon exit. The syntax SET ... FROM CURRENT is used to revert the session's configuration back to its original state, making it essential for scenarios where temporary session configurations are needed.
However, the current version of Atlas HCL does not seem to support the SET ... FROM CURRENT syntax within function definitions, which is not limited to lock_timeout but applies to any session configuration.
Adding support for this syntax in function definitions would significantly enhance Atlas's ability to manage and manipulate temporary session settings efficiently.
Thank you for considering this request.
The text was updated successfully, but these errors were encountered:
Note: It is important to mention that FROM CURRENT does not always refer to the actual current session state. Unfortunately, it refers to the state at the time the CREATE FUNCTION command is executed. Despite this limitation, using the syntax like SET lock_timeout TO '0' is still very meaningful, and therefore, I strongly request that this syntax be supported at a minimum.
mpyw
changed the title
Feature Request: Support for SET ... FROM CURRENT in Function Definition Syntax
Feature Request: Support for SET configuration_parameter { TO value | = value | FROM CURRENT } in Function Definition Syntax
Aug 18, 2024
Description:
I would like to request a new feature in Atlas HCL to support the following SQL syntax within function definitions:
In this example, the function temporarily sets the advisory lock timeout and restores the previous value upon exit. The syntax
SET ... FROM CURRENT
is used to revert the session's configuration back to its original state, making it essential for scenarios where temporary session configurations are needed.However, the current version of Atlas HCL does not seem to support the
SET ... FROM CURRENT
syntax within function definitions, which is not limited tolock_timeout
but applies to any session configuration.Adding support for this syntax in function definitions would significantly enhance Atlas's ability to manage and manipulate temporary session settings efficiently.
Thank you for considering this request.
The text was updated successfully, but these errors were encountered: