{"id":14063371,"url":"https://github.com/splendiddata/session_variable","last_synced_at":"2025-08-10T22:48:01.855Z","repository":{"id":68427402,"uuid":"109681723","full_name":"splendiddata/session_variable","owner":"splendiddata","description":"The session_variable Postgres database extension provides a way to create and maintain session scoped variables and constants, more or less like Oracle's global variables.","archived":false,"fork":false,"pushed_at":"2025-05-09T15:34:07.000Z","size":118,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-09T16:42:28.942Z","etag":null,"topics":["postgres","postgresql","postgresql-extension"],"latest_commit_sha":null,"homepage":null,"language":"PLpgSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/splendiddata.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-11-06T10:38:00.000Z","updated_at":"2025-05-09T15:34:12.000Z","dependencies_parsed_at":"2025-04-28T12:51:54.528Z","dependency_job_id":"806eef0d-9e1e-4f44-9fb2-9b1642ea2b30","html_url":"https://github.com/splendiddata/session_variable","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/splendiddata/session_variable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splendiddata%2Fsession_variable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splendiddata%2Fsession_variable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splendiddata%2Fsession_variable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splendiddata%2Fsession_variable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/splendiddata","download_url":"https://codeload.github.com/splendiddata/session_variable/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/splendiddata%2Fsession_variable/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269803680,"owners_count":24477647,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgres","postgresql","postgresql-extension"],"created_at":"2024-08-13T07:03:18.385Z","updated_at":"2025-08-10T22:48:01.833Z","avatar_url":"https://github.com/splendiddata.png","language":"PLpgSQL","funding_links":[],"categories":["PLpgSQL"],"sub_categories":[],"readme":"# session_variable\nThe session_variable Postgres database extension provides a way to create and\nmaintain session scoped variables and constants. This extension can be part of\na solution to mimic Oracle's global constants and variables.\n\u003ch2\u003eIntroduction\u003c/h2\u003e \nThe session_variable extension registers variables and constants. But internally\nthey are intermixed and treated as the same. There is just a boolean that\nindicates whether or not the session_variable.set(variable_name, value) can be\ninvoked. So variable names and constant names must be unique within both types.\nFor the remaining text where variables are mentioned, constants are meant as\nwell.\n\nVariables (and constants) are defined (created) on the database level. Each user\nsession will get a local copy of all defined variables on first invocation of\nany of the session_variable functions. Invocations of\nsession_variable.set(variable_name, value) will ONLY alter the content of the\nsession local copy of the variable. Other sessions will not be affected in any\nway - they have their own copy at their disposal.\n\nThe session_variable.init() function reloads all defined variables from the\nsession_variable.variables table. This function will be invoked when a session\nstarts, and can be invoked at any time. All variables will be reverted to their\ninitial state.\n\nVariables can be defined using the\nsession_variable.create_variable(variable_name, variable_type),\nsession_variable.create_variable(variable_name, variable_type, initial_value)\nor session_variable.create_constant(constant_name, constant_type, value)\nadministrator functions. The initial value can be null - even the value of a\nconstant (the profit of this is disputable).\n\nThe initial value or the constant value can be altered using the\nsession_variable.alter_value(variable_or_constant_name, value) administrator\nfunction. The administrator who invokes the alter_value() function will see the\naltered value immediately, but all existing sessions will remain working with\nthe old value or the value that they set themselves. Any new session will see\nthe altered value. Invocation of the session_variable.init() function will make\nthe altered value available on the session in which it is invoked.\n\nA variable can be removed using the\nsession_variable.drop(variable_or_constant_name) administrator function. And\nhere again existing sessions will not notice any change unless they invoke the\nsession_variable.init() function.\n\n\u003ch3\u003eExample:\u003c/h3\u003e\n\n```\n-- First create a variable\nselect session_variable.create_variable('my_variable', 'text'::regtype, 'initial text'::text);\n\n-- Checked if that worked\nselect session_variable.get('my_variable', null::text);\n\n-- Change the content of the variable\u003cbr\u003e\n-- Notice that the prior content is returned\nselect session_variable.set('my_variable', 'changed text'::text);\n\n-- Used in a bit of plpgsql code\ndo $$\u003cbr\u003e\ndeclare\u003cbr\u003e\n    my_field text;\nbegin\n    my_field := session_variable.get('my_variable', my_field);\n    raise notice 'the content of my_field is \"%\"', my_field;\nend\n$$ language plpgsql;\n\n-- cleanup\nselect session_variable.drop('my_variable');\n```\n\n\u003ch2\u003ePostgres versions\u003c/h2\u003e\nThe session_variable database extension runs on Postgres versions 12 - 18.\n\u003ch2\u003eInstallation\u003c/h2\u003e\nInstall as a normal Posrgres database extension:\u003cbr\u003e\n - Make sure pg_config points to the right places\u003cbr\u003e\n - execute make\u003cbr\u003e\n - execute sudo make install installcheck\u003cbr\u003e\nand then in the Postgres database execute:\u003cbr\u003e\n - create extension session_variable;\n \n\u003ch2\u003eFunctions\u003ch2\u003e\n\n\u003ch3\u003esession_variable.create_variable(variable_name, variable_type)\u003c/h3\u003e\nThe create_variable function creates a new variable with initial value null.\n\nThe created variable will be available in the current session and in sessions\nthat are created after the committed invocation of\nsession_variable.create_variable(variable_name, variable_type). Existing\nsessions do not see the altered situation unless they invoke the\nsession_variable.init() function.\n\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable to be created\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_type\u003c/td\u003e\n      \u003ctd\u003eregtype\u003c/td\u003e\n      \u003ctd\u003eThe datatype that can be stored in the\n        variable\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if ok\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable type must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e2200F\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e23505\u003c/td\u003e\n      \u003ctd\u003eVariable \"\u003ci\u003e\u0026lt;variable name\u0026gt;\u003c/i\u003e\"\n        already exists\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.create_variable('my_variable',\n      'text'::regtype);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.create_variable(variable_name, variable_type, initial_value)\n  \u003c/h3\u003e\n  \u003cp\u003eThe create_variable function creates a new variable with the specified\n    initial value.\u003c/p\u003e\n  \u003cp\u003eThe created variable will be available in the current session and in\n    sessions that are created after the committed invocation of\n    session_variable.create_variable(variable_name, variable_type,\n    initial_value). Existing sessions do not see the altered situation unless\n    they invoke the session_variable.init() function.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable to be created\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_type\u003c/td\u003e\n      \u003ctd\u003eregtype\u003c/td\u003e\n      \u003ctd\u003eThe datatype that can be stored in the\n        variable\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd valign=\"top\"\u003einitial_value\u003c/td\u003e\n      \u003ctd valign=\"top\"\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eThe initial value that will be loaded\n        on session start and to which the variable will be reverted when the\n        session_variable.init() function is invoked. \u003cbr\u003e \u003cbr\u003e The\n        value must have the type specified by variable_type.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if ok\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable type must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e2200F\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003evalue must be of type \u003ci\u003e\u0026lt;variable_type\u0026gt;\u003c/i\u003e,\n        but is of type \u003ci\u003e\u0026lt;the actual type\u0026gt;\u003c/i\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e23505\u003c/td\u003e\n      \u003ctd\u003eVariable \"\u003ci\u003e\u0026lt;variable_name\u0026gt;\u003c/i\u003e\"\n        already exists\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.create_variable('my_date_variable',\n      'date'::regtype, '2015-07-16'::date);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.create_constant(constant_name, constant_type, value)\n  \u003c/h3\u003e\n  \u003cp\u003eThe create_constant function creates a new constant with the specified\n    value.\u003c/p\u003e\n  \u003cp\u003eA constant is just a variable, but it's content cannot be changed by a\n    set(variable_name, value) function invocation.\u003c/p\u003e\n  \u003cp\u003eThe created constant will be available in the current session and in\n    sessions that are created after the committed invocation of\n    session_variable.create_constant(constant_name, constant_type, value).\n    Existing sessions do not see the altered situation unless they invoke the\n    session_variable.init() function.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003econstant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the constant to be created\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003econstant_type\u003c/td\u003e\n      \u003ctd\u003eregtype\u003c/td\u003e\n      \u003ctd\u003eThe datatype that will be stored in\n        this constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd valign=\"top\"\u003evalue\u003c/td\u003e\n      \u003ctd valign=\"top\"\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eThe value that will be loaded on\n        session start or inocation of the session_variable.init() function. \u003cbr\u003e\n        \u003cbr\u003e The value must have the type specified by constant_type.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if ok\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003econstant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003econstant type must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e2200F\u003c/td\u003e\n      \u003ctd\u003econstant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003evalue must be of type \u003ci\u003e\u0026lt;constant_type\u0026gt;\u003c/i\u003e,\n        but is of type \u003ci\u003e\u0026lt;the actual type\u0026gt;\u003c/i\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e23505\u003c/td\u003e\n      \u003ctd\u003eVariable \"\u003ci\u003e\u0026lt;variable_name\u0026gt;\u003c/i\u003e\"\n        already exists\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect\n      session_variable.create_constant('my_environment_constant',\n      'text'::regtype, 'Production'::text);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.alter_value(variable_or_constant_name, value)\n  \u003c/h3\u003e\n  \u003cp\u003eAlters the value of the contstant or the initial value of the variable.\u003c/p\u003e\n  \u003cp\u003eThe altered value will be available in the current session and in\n    sessions that are created after the committed invocation of\n    session_variable.alter_value(variable_or_constant_name, value). Existing\n    sessions do not see the altered situation unless they invoke the\n    session_variable.init() function.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_or_constant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable or constant of\n        which the value is to be changed\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd valign=\"top\"\u003evalue\u003c/td\u003e\n      \u003ctd valign=\"top\"\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eThe value new (initial) value for the\n        specified variable or constant \u003cbr\u003e \u003cbr\u003e The value must have\n        the type that was specified when the variable or constant was created.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if ok\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable or constant \"\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable or constant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e2200F\u003c/td\u003e\n      \u003ctd\u003evariable or constant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003evalue must be of type \u003ci\u003e\u0026lt;type\u0026gt;\u003c/i\u003e,\n        but is of type \u003ci\u003e\u0026lt;the actual type\u0026gt;\u003c/i\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.alter_value('my_environment_constant',\n      'Development'::text);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.drop(variable_or_constant_name)\n  \u003c/h3\u003e\n  \u003cp\u003eRemoves the specified constant or variable.\u003c/p\u003e\n  \u003cp\u003eThe constant or variable will be available any more in the current\n    session and in sessions that are created after the committed invocation of\n    session_variable.drop(variable_or_constant_name). Existing sessions do not\n    see the altered situation unless they invoke the session_variable.init()\n    function.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003earguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_or_constant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable or constant to be\n        removed\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if ok\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable or constant \"\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable or constant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e2200F\u003c/td\u003e\n      \u003ctd\u003evariable or constant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.drop('my_environment_constant');\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.init()\n  \u003c/h3\u003e\n  \u003cp\u003eReloads all variables and constants in the current session\u003c/p\u003e\n  \u003cp\u003eAll variables that have been changed using\n    session_variable.set(variable_name, value) invocations will be undone. The\n    effect is visible in the current session only. All other sessions are left\n    untouched.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eNo arguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003einteger\u003c/td\u003e\n      \u003ctd\u003ethe number of variabes and constants\n        that are loaded\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eNo exceptions\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.init();\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.set(variable_name, value)\n  \u003c/h3\u003e\n  \u003cp\u003eThe set function changes the content of a variable.\u003c/p\u003e\n  \u003cp\u003eThe changed content will be visible in the current session only. The\n    session_variable.set(variable_name, value) function will no affect any other\n    session in any way. Invocation of the session_variable.init() function will\n    undo the effect of any previously invoked\n    session_variable.set(variable_name, value) function call.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable to update\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd valign=\"top\"\u003evalue\u003c/td\u003e\n      \u003ctd valign=\"top\"\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eThe new content for the variable. \u003cbr\u003e\n        \u003cbr\u003e The value must have the type specified for the variable.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if ok\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable \"\u003ci\u003e\u0026lt;variable_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e0A000\u003c/td\u003e\n      \u003ctd\u003econstant \"\u003ci\u003e\u0026lt;variable_name\u0026gt;\u003c/i\u003e\"\n        cannot be set\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e2200F\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003evalue must be of type \u003ci\u003e\u0026lt;variable_type\u0026gt;\u003c/i\u003e,\n        but is of type \u003ci\u003e\u0026lt;the actual type\u0026gt;\u003c/i\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.set('my_variable', 'a bit of text for\n      my variable'::text);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.get(variable_or_constant_name,\n    just_for_result_type)\n  \u003c/h3\u003e\n  \u003cp\u003eReturns the session local content of the named variable or constant.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_or_constant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable or constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd valign=\"top\"\u003ejust_for_result_type\u003c/td\u003e\n      \u003ctd valign=\"top\"\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eIn postgres, a function can only return\n        anyelement if it has got an anyelement argument. The type of the\n        anyelement argument will be the same as the anyelement returntype. So we\n        need an argument here with the type of the variable or constant. \u003cbr\u003e\n        \u003cbr\u003e The value must have the type specified for the variable or\n        constant.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eThe content of the variable or constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable or constant \"\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003eplease invoke as session_variable.get(\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e,\n        null::\u003ci\u003e\u0026lt;type\u0026gt;\u003c/i\u003e)\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.get('my_variable', null::text);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.get_stable(variable_or_constant_name,\n    just_for_result_type)\n  \u003c/h3\u003e\n  \u003cp\u003e\n\t\tDoes excactly the same as the session_variable.get() function. But the\n\t\tget_stable() function is marked \"STABLE\" (see: \u003ca\n\t\t\thref=\"https://www.postgresql.org/docs/current/sql-createfunction.html\"\n\t\t\ttarget=\"_blank\"\u003ehttps://www.postgresql.org/docs/current/sql-createfunction.html\u003c/a\u003e).\n\t\tSo the result of the function may be cached during the execution of a\n\t\tstatement. This behaviour will be right for practically all invocations. Only\n\t\twhen the value of a variable is altered within the execution of a statement,\n\t\tfor example in trigger code, then unexpected results may occur.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_or_constant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable or constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd valign=\"top\"\u003ejust_for_result_type\u003c/td\u003e\n      \u003ctd valign=\"top\"\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eIn postgres, a function can only return\n        anyelement if it has got an anyelement argument. The type of the\n        anyelement argument will be the same as the anyelement returntype. So we\n        need an argument here with the type of the variable or constant. \u003cbr\u003e\n        \u003cbr\u003e The value must have the type specified for the variable or\n        constant.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eThe content of the variable or constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable or constant \"\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003eplease invoke as session_variable.get(\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e,\n        null::\u003ci\u003e\u0026lt;type\u0026gt;\u003c/i\u003e)\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.get_stable('my_variable', null::text);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.get_constant(constant_name,\n    just_for_result_type)\n  \u003c/h3\u003e\n  \u003cp\u003eReturns the session local content of the named constant.\u003c/p\u003e\n\t\u003cp\u003e\n\t\tBEWARE! this function is marked as \"IMMUTABLE\" (see: \u003ca\n\t\t\thref=\"https://www.postgresql.org/docs/current/sql-createfunction.html\"\n\t\t\ttarget=\"_blank\"\u003ehttps://www.postgresql.org/docs/current/sql-createfunction.html\u003c/a\u003e).\n\t\tThis means that te database is allowed to cache the function result for a\n\t\tgiven combination of arguments. This is a good optimisation in normal\n\t\toperation. But when altering the content of constants make sure that you use\n\t\tthe get() function instead of get_constant() as there is a chance that you get\n\t\ta cached result when invoking get_constant().\n\t\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_or_constant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable or constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd valign=\"top\"\u003ejust_for_result_type\u003c/td\u003e\n      \u003ctd valign=\"top\"\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eIn postgres, a function can only return\n        anyelement if it has got an anyelement argument. The type of the\n        anyelement argument will be the same as the anyelement returntype. So we\n        need an argument here with the type of the constant. \u003cbr\u003e\n        \u003cbr\u003e The value must have the type specified for the variable or\n        constant.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eanyelement\u003c/td\u003e\n      \u003ctd\u003eThe (cached) content of the constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable or constant \"\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003econstant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003eplease invoke as session_variable.get_constant(\u003ci\u003e\u0026lt;constant_name\u0026gt;\u003c/i\u003e,\n        null::\u003ci\u003e\u0026lt;type\u0026gt;\u003c/i\u003e)\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd class=\"arguments argname\"\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd class=\"arguments argtype\"\u003e42809\u003c/td\u003e\n      \u003ctd class=\"arguments argdesc\"\u003e\u003ci\u003e\u0026lt;constant_name\u0026gt;\u003c/i\u003e is not a constant\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.get_constant('my_constant', null::varchar[]);\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.exists(variable_or_constant_name)\n  \u003c/h3\u003e\n  \u003cp\u003eReturns the specified variable exists in the local session.\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eArguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if the variable or constant exists in\n        the current session.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22023\u003c/td\u003e\n      \u003ctd\u003eplease invoke as session_variable.exists(\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e)\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.exists('my_variable');\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.type_of(variable_or_constant_name)\n  \u003c/h3\u003e\n  \u003cp\u003eReturns the type of the variable or constant\u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003earguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_or_constant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable or constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eregtype\u003c/td\u003e\n      \u003ctd\u003eThe type of the specified variable or\n        constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable or constant \"\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable or constant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.type_of('my_variable');\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.is_constant(variable_or_constant_name)\n  \u003c/h3\u003e\n  \u003cp\u003e\n    Returns true if \"\u003ci\u003evariable_or_constant_name\u003c/i\u003e\" happens to be a constant\n    or false if it is a session variable\n  \u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003earguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003evariable_or_constant_name\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eName of the variable or constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eregtype\u003c/td\u003e\n      \u003ctd\u003eThe type of the specified variable or\n        constant\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e02000\u003c/td\u003e\n      \u003ctd\u003evariable or constant \"\u003ci\u003e\u0026lt;variable_or_constant_name\u0026gt;\u003c/i\u003e\"\n        does not exist\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003e22004\u003c/td\u003e\n      \u003ctd\u003evariable or constant name must be filled\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.type_of('my_variable');\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.dump(do_truncate)\n  \u003c/h3\u003e\n  \u003cp\u003e\n    Generates a 'script' that may be used as backup. \n  \u003c/p\u003e\n  \u003cp\u003e\n    Take care when using PSQL's \\copy command. It will double all backslash (\\)\n    characters.\n  \u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003earguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\"\u003ename\u003c/th\u003e\n      \u003cth align=\"left\"\u003etype\u003c/th\u003e\n      \u003cth align=\"left\"\u003edescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003edo_truncate\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003eOptional argument, default true.\u003cbr\u003e\u003cbr\u003eIf true then the first line\n        returned will be \"truncate table session_variable.variables;\". If false\n        then the truncate statement will not be returned and all definitions\n        will be appended with \" where not\n        session_variable.exists(\u003cvariable_name\u003e)\" \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003esetof text\u003c/td\u003e\n      \u003ctd\u003eThe lines that together form the script.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"3\"\u003enone\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.dump();\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.get_session_variable_version()\n  \u003c/h3\u003e\n  \u003cp\u003e\n    Returns the code version of the extension, currently '3.4'. \n  \u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003earguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"3\"\u003enone\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003etext\u003c/td\u003e\n      \u003ctd\u003eThe code version of the session_variable\n       extension.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"3\"\u003enone\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\u003cbr\u003e\n    \u003ccode\u003eselect session_variable.get_session_variable_version();\u003c/code\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    session_variable.is_executing_variable_initialisation()\n  \u003c/h3\u003e\n  \u003cp\u003e\n    Returns true if a user-provided function called session_variable.variable_initialisation()\n    is currently being invoked on behalf of session_variable initialisation. Thus the\n    session_variable.variable_initialisation() function can check if it not illegally\n    invoked outside session_variable initialisation code.\n  \u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003earguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"3\"\u003enone\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003eboolean\u003c/td\u003e\n      \u003ctd\u003etrue if a function called session_variable.variable_initialisation() \n        is currently being invoked on behalf of session_vairable initialisation\n        code. In all other cases the return will be false.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"3\"\u003enone\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\n  \u003ch3\u003e\n    session_variable.variable_initialisation()\n  \u003c/h3\u003e\n  \u003cp\u003e\n    This function is NOT provided by the database extension, but might be created\n    by you! \n  \u003c/p\u003e\n  \u003cp\u003e\n    If the function exists, it will be invoked by the session_variable initialisation\n    code just after all values with their default values are loaded from the\n    session_variable.variables table, but before any other action takes place.\n  \u003c/p\u003e\n  \u003cp\u003e\n    During the execution for the session_variable.variable_initialisation() function\n    on behalf of session variable initialisation, also values of constants can\n    be set.\n  \u003c/p\u003e\n  \u003ctable class=\"arguments\"\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003earguments\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd colspan=\"3\"\u003enone\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eReturns\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd\u003evoid\u003c/td\u003e\n      \u003ctd\u003eOr anything you like. The result will be ignored by session_variable\n      initialisation code\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth align=\"left\" colspan=\"3\"\u003eExceptions\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u0026nbsp;\u003c/td\u003e\n      \u003ctd colspan=\"2\"\u003eMake sure you don't throw any!\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n  \u003cp\u003e\n    Example:\n  \u003c/p\u003e\n  \n```\ncreate or replace function session_variable.variable_initialisation()\n   returns void\n   language plpgsql\n   as $$\nbegin\n   if not session_variable.is_executing_variable_initialisation()\n   then\n       raise sqlstate '55099' using message =\n          'This function can only be invoked as part of session_variable initialisation';\n   end if;\n   perform session_variable.set('headline_of_the_day',\n      'we have nice weather today'::varchar);\nexception\n   when sqlstate '55099' then\n      raise;\n  when others then\n     raise log 'error occurred in session_variable.variable_initialisation(), sqlstate=%, sqlerrm=%',\n               sqlstate, sqlerrm;\nend;\n$$;\n```\n\n\u003ch2\u003eSecurity\u003c/h2\u003e\n\u003cp\u003e\nUsage of session_variable.create_variable(variable_name, variable_type),\nsession_variable.create_variable(variable_name, variable_type, initial_value),\nsession_variable.create_constant(constant_name, constant_type, value),\nsession_variable.alter_value(variable_or_constant_name, value),\nsession_variable.drop(variable_or_constant_name) and \nsession_variable.dump() is protected by the\n\"session_variable_administrator_role\". \n\u003c/p\u003e\u003cp\u003e\nThe remaining functions are protected by the \"session_variable_user_role\".\n\u003c/p\u003e\u003cp\u003e\nThe \"session_variable_administrator_role\" includes the \n\"session_variable_user_role\".\n\u003c/p\u003e\n\n## Save / restore\n\nSession variables are stored in the session_variable.variables table, which \ncan be saved and restored as any other table. Restored values will be visible\nto all sessions that started after the restore committed. Sessions that were\nstarted before the restore will still see the old (session local!) content\nunless they invoke session_variable.init().\n\n## Release notes\n### version 2\nIn version 1, the initial values of variables and constants were stored in the\nsession_variable.variables table in a bytea representing a memory image of the\ncontent. This appeared problematic when copying data from one database to\nanother as in array types and composite types oids are present in the memory\nimage. So in version 2 the initial_value column is altered to a text column and\nserialization and deserialization is now routed via the typinput and typoutput\nfunctions. So now a database dump is portable (provided that the receiving\ndatabase has got all user defined types available).\n\nReturning the previous value in the set() function and the alter() function\nproved not very useful and did impose some overhead. So in version 2 these\nfunctions return just a boolean, which will be 'true' in all cases.\n#### upgrade to version 2\nOn the command line:\n\n\u003e git pull\u003cbr\u003e\n\u003e make clean\u003cbr\u003e\n\u003e make\u003cbr\u003e\n\u003e sudo make install\n\nThen in a new database session\n\n\u003e alter extension session_variable update;\n\nPs.\u003cbr\u003e\nThe database will keep using the version 1 implementation of the extension\nuntil the \"alter extension session_variable update;\" command is executed. Make\nsure you do not restore any dump of the session_variable.variables table that\nwas created before the \"alter extension session_variable update;\" into a\ndatabase that already executes version 2.\n### version 3\nAdded functions get\\_stable() and get\\_constant().\n### version 3.1\nRemoved the .so file extension from the function definitions so they might work\non Windows as well.\n### version 3.2\nSome textual changes in the session_variable.c file to keep cppcheck fund bug hapy.\nSee: \u003ca href=\"https://github.com/splendiddata/session_variable/issues/5\"\n\t\t\ttarget=\"_blank\"\u003ehttps://github.com/splendiddata/session_variable/issues/5\u003c/a\u003e\n### version 3.3\nAdapted the new Postgres rule that extensions shalt not use 'create of not exists' and\n'create or replace' constructs.\u003cbr\u003e\nDiscontinued support for session_variables version 1.0.\n### version 3.4\nJust made ready for Postgres 17","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplendiddata%2Fsession_variable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsplendiddata%2Fsession_variable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsplendiddata%2Fsession_variable/lists"}