Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ooO18-0000Uf-0H for pgsql-docs@arkaria.postgresql.org; Fri, 28 Oct 2022 11:59:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ooO14-0001Xt-In for pgsql-docs@arkaria.postgresql.org; Fri, 28 Oct 2022 11:59:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ooO14-0001Xk-5n for pgsql-docs@lists.postgresql.org; Fri, 28 Oct 2022 11:59:14 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ooO11-0005Pu-5b for pgsql-docs@lists.postgresql.org; Fri, 28 Oct 2022 11:59:13 +0000 Received: by mail-ej1-x630.google.com with SMTP id 13so12436021ejn.3 for ; Fri, 28 Oct 2022 04:59:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=TpFDxA2OYJ1Q+PVEYk/3+L5oYkVsN1HpGxLhU+AS/RI=; b=HrILffLP27aXPseeqkyBmCW1wQ+VmLMRhi1Mnh/eN6TXyIRvdtQqdSiqzSXo0PSZsB mRfkElu9rUzO/ly3qm/ct3TyQc9PJyOyFOIpmj2dT+UUUlTaiZz4Zbx5Cjsnls9StECT eA78iWzdhWGQJER0kW14FkgUt9F75Gbj2FDra3trK3f0wPvJy4HTgLUk4CSxG7pr9jIo uQMuxUdLr/O40u/HthsP8E+fEDiT5gQ1XrqkrMP+34pw+jG3y+nWdJ1uVg+uH1QbHRy9 NTa0a7g/Zi/INhX9BjAPFGuGIHjVIov87oGCyRDu9zX6trZ3lpKF5CDCwJIDrt0Gl2tH AqfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TpFDxA2OYJ1Q+PVEYk/3+L5oYkVsN1HpGxLhU+AS/RI=; b=0lExmTQHEfFf8ikZdCp4/BK/ULqwGxRll5SJVuu9Si6tc+YGAcC9d0lHK/kR+FiSdK W18cc6Fv6NPxo3THSDnWrMwXs8kHBSE1HA2Zu+a1XF8QFxQlZbJB2GlSZoj98SAMLHIy 2EjGsEA1IIe5wgLd87Bjw6/jUKb34Yqp9QSmCZV0CheXuxZ1uWqtlTjt0W6t3PPH64W6 phobNYt71PeinAIApRRre2S8A7nsY6eoAwNLQ74/M6NH4WkxEGDcCrJTJIaogu7kkFN/ n522wamlCz5EGwezoEMxYdmnDg+47JlSXkylmbVfhlVp3UHlKUOP4sqm/mnZ7FEeOXVd 2rNw== X-Gm-Message-State: ACrzQf3n/7VpQzJ5BReSy4JxyMXGu9aIOHH9bQNA57B4VUp2llqQiSTL danjxWM0EMuWE2+sXx6tGHSxlT+sDE6FGw== X-Google-Smtp-Source: AMsMyM4j7Z7iqMrYTAhaTotPmMwiu0h8K0O3gJMibDKG6X4vBC+L6oYqyKpmv4CVIgqH23cyS78PUA== X-Received: by 2002:a17:907:7b93:b0:770:1d4f:4de9 with SMTP id ne19-20020a1709077b9300b007701d4f4de9mr47365802ejc.201.1666958349372; Fri, 28 Oct 2022 04:59:09 -0700 (PDT) Received: from localhost.localdomain ([213.182.142.66]) by smtp.gmail.com with ESMTPSA id kx26-20020a170907775a00b0073ae9ba9ba8sm2128089ejc.3.2022.10.28.04.59.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Oct 2022 04:59:08 -0700 (PDT) Message-ID: <7fac2a589357d64cb249b057ddb91d7e747722c9.camel@cybertec.at> Subject: Re: SET feature From: Laurenz Albe To: danydb@noalyss.eu, pgsql-docs@lists.postgresql.org Date: Fri, 28 Oct 2022 13:59:08 +0200 In-Reply-To: <166695204625.630.3067402447013848509@wrigleys.postgresql.org> References: <166695204625.630.3067402447013848509@wrigleys.postgresql.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2022-10-28 at 10:14 +0000, PG Doc comments form wrote: > I remember in version 9 , to use variable you had to change in the > postgresql. > > Today it is easier , just use > > SET SESSION myprefix.myvariable =  'whatever' > > and all the transactions can use it , it is very useful in some cases, for > example to track the author of a change , you don't need to change all your > java/php/python code , just use a trigger on the table to fill up a column > "change_by" > > I've checked the documentation and that feature is not explained at all, not > even in the SET Command. Most people consider this a kind of abuse of what is known as "placeholder parameters", documented in https://www.postgresql.org/docs/current/runtime-config-custom.html See for example https://postgr.es/m/2982579.1662416866%40sss.pgh.pa.us I believe it is a deliberate choice not to advertise that as "session variables", particularly since there is an improvement in the pipeline: https://commitfest.postgresql.org/40/1608/ Yours, Laurenz Albe