Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1va2Dr-002iGl-0Q for pgsql-general@arkaria.postgresql.org; Mon, 29 Dec 2025 01:39:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1va2Dp-00Ekda-1T for pgsql-general@arkaria.postgresql.org; Mon, 29 Dec 2025 01:38:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1va2Dp-00EkdR-08 for pgsql-general@lists.postgresql.org; Mon, 29 Dec 2025 01:38:57 +0000 Received: from mout.perfora.net ([74.208.4.196]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1va2Dn-003K3z-0l for pgsql-general@lists.postgresql.org; Mon, 29 Dec 2025 01:38:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meddatainc.com; s=s1-ionos; t=1766972333; x=1767577133; i=agents@meddatainc.com; bh=Nb6JQlYVZ45P34NJ3qGgCAykW3LaIE5eLuDL57GWN9g=; h=X-UI-Sender-Class:Date:MIME-Version:Content-Type: Content-Transfer-Encoding:Subject:To:From:Message-ID:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=1MnNeG5+1sAiBFoof42pfsR2ag8CcL121F9Gle6uUtxy809nJklyu25wzxhNvper GNIr10mObm9mhMfVRf46m+29qG6FqUw0P4i52TgJYoW2ZZoub/1GIMYj9UVBH3ulI fda2wn87Y01FFYFoBnZ7MTvN+s78cbWz9HygDj4Op71OwV9twYTK+9eWmi/otR/uk F9UG2J7KnL/rhBUQo0Uout5ScGi3bwt4fnL4esal1mT8hW6jAL3rFDm9GMLFu34ub 0IKlxHU27+boUm9SnVfNCZkjhbzOAt5g1LiS/6fKZLjgGjBEkn47WIojrO8EcRFnp Ot2ZkH5wcpcmCKvgbw== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from [10.120.190.106] ([166.170.35.10]) by mrelay.perfora.net (mreueus003 [74.208.5.2]) with ESMTPSA (Nemesis) id 0M3hp9-1vr9Qq1dPV-0118nz for ; Mon, 29 Dec 2025 02:38:53 +0100 Date: Sun, 28 Dec 2025 20:38:50 -0500 User-Agent: K-9 Mail for Android MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Combining metavariables and table names To: PostgreSQL Users Mailing List From: H Message-ID: <8254F175-871C-4678-8D28-A67E09B099A6@meddatainc.com> X-Provags-ID: V03:K1:kWmrvtUciZlJGE5FXdV2JKLq/SAbzer1gt81lf6OZdp3LfCeAMr VFUPY8MorIvjaNG4h4VsPUnZcLCsmKQ9eDo2IAkjyEFXo7pOp811oC8KG9qwjqvcHRFMixz 93ZSu0eJxLH5nyHSzpmeLL5jcf0krAm80p6ZZYN/zCCvsg2qs8dhbGceNmY40aY1K0fkNwK CmMzYW8wPw2AriNNRHK+w== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:K4S2hFNq6A0=;5L3MG+6QJxkRNDUf6jljbm6YRX+ tqyg5Wk0ehK0zj/dZlumJw+Pmu0ENj/VpWOQFxeC3RSlyhbaI+oGZPyf9riTP4nhm97j6NhOY cXA7FcUn0OwJcbC+1fqkH/D9X2y11OXDqkqc9N3bxXVn+W/CEOzI1t7coCvYJJIGog3PLb2Vu XacZmiTI7w0+XKXLlDXyQSbHE1TZXxlb2pc9FGh0iCpA+vrQyYi04s0rxw2+eGJyk2/9a5qDu 6eLbGjaXhG86U4IvIPKaslx8sqRYR18h4u2f4FTVPCZk6gsinD74Wqnl1sCz/50T8IrJ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cLw7D7i9jIGnqTVLBkYNNBM C4U1RPxjGqZYqJu3ZgzAUpi5MdN4OxQ/7R/m7IYuI72cGOgRMzjWAjL0AIwbWTT91V5/gKTc+ KfFCNAO733l67NYMfr+KRj4X3cp1ZSpvGTohog63CNWJJp7/F8QUHhUGPWLCg67/MATBKpS17 6fB5+4e8zUAqkfpY3M8L0pidZKCghrrmG2BSDt8auc3rTfRHBG+n24ULFUK9s1EJPyAiRM6fK HRG60mQ/2qOjtRMwemKnJLlKVee9Hc+b7LAEs+KcbXhaZJOd/Ndnxev3BQ6d073XWNRjtsoFB pSmzBxOvbM5Ig8FxCh0xo1u8rWBofGtKucSj395yVszIld6Oap5r1/NtqvOK+tpt2SRNiYm9a a4iHbAOlwItch List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Running postgresql 16 on Rocky Linux 9 developing a multi-tenant applicatio= n where tenants will be represented by individual schemes=2E I am using the temporal tables extension to save updated/deleted rows and = am running into a problem=2E During the development I am creating tables in= an SQL files for testing=2E In my example, the SQL files also create a ver= sioning trigger for the example table test using test_history to store upda= ted/deleted rows using the following statements: Metavariable to store schema: \set s t =2E=2E=2E CREATE OR REPLACE TRIGGER versioning_trigger BEFORE INSERT OR DELETE OR UPDATE ON :s=2Etest FOR EACH ROW EXECUTE PROCEDURE public=2Eversioning('sys_period', ':s=2Etest_history= ', 'true'); Creating the tables works as expected, as does inserting data into them=2E= However, updating/deleting rows the following generates the error message = "ERROR: schema ":s" does not exist" even though it does exist=2E I have tr= ied different variations of ':s=2Etest_history' such as :"s"'=2Etest_histor= y" and a number of other variations, none of which work for the update/dele= tion of a row=2E The only way I have gotten it to work is to add the following statement to= the SQL file creating tables: \set stest :s'=2Etest_history' and then to reference it like: CREATE OR REPLACE TRIGGER versioning_trigger BEFORE INSERT OR DELETE OR UPDATE ON :s=2Etest FOR EACH ROW EXECUTE PROCEDURE public=2Eversioning('sys_period', :"stest", 'true') Note the placement of the colon and the use of trouble quotes=2E I have a feeling I might be missing how to use the combination of a metava= riable and a table name when used in an argument to a procedure=2E Even though I gotten it to work, what would the correct usage be? Thanks=2E