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 1vaONT-007ltn-2g for pgsql-general@arkaria.postgresql.org; Tue, 30 Dec 2025 01:18:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vaONS-001Uf4-2V for pgsql-general@arkaria.postgresql.org; Tue, 30 Dec 2025 01:18:23 +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 1vaONS-001Uew-1S for pgsql-general@lists.postgresql.org; Tue, 30 Dec 2025 01:18:23 +0000 Received: from mail-oa1-x30.google.com ([2001:4860:4864:20::30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vaONR-003UBE-0M for pgsql-general@lists.postgresql.org; Tue, 30 Dec 2025 01:18:22 +0000 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-3fa11ba9ed5so6222772fac.0 for ; Mon, 29 Dec 2025 17:18:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767057494; x=1767662294; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3sTkRarDiOF2Z8eb8w5xmp+hxHwsEY4v4rYnuJhhNzw=; b=aFyfPqDUNYGXd8f1nfUPtoKnLuvOBaMLcYJG170DlrrUXl3oWUE03A0cvLTOxMItur /DG2h1ksqvYKrWaO4+VeFzkb9uI2EwXgj5C21cnJZi8VtbsFv1w/U28FA9hiTXqTolGl fyBxeb1irlnRicH6Mpcjx978Ma9cAmp83fWZqUYsGYTmZqnmWq1wYg0NmmZMzW3Gywe6 UtMxyumtFj6iarBXN+slEvDy6kF17rngit5aseR8Zw4ouq5OO3I4R6jYe/iNtrLaAlpQ flZFskdFYlGZwkqJyXLFpEk5JIayV3oizBmCrVWDpNTpWFRUqwZoY6i/EkjhpHS9NntB WawA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767057494; x=1767662294; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3sTkRarDiOF2Z8eb8w5xmp+hxHwsEY4v4rYnuJhhNzw=; b=rLpSaUZYY8J5cdEyZUahP8BpEMTEjobulI8UtOP7e+2Dt851rTqtSPwm3DMwrNXqh1 AuDpAHVTu9O1Sea6EMmdn/BOg3aD2SSiJIgd1edBfYQaH2mQzrA6JyPe478T6NBd5SMs e8Umj4y6/bfgQs5aggtan/kkTej70BZDu7i1rw/gKeqeCLOQWjsIUbkinoEmxY59N+HD RxNK6pAbxiY6g0OcqrkPxniWFgsWNN232K+ou6CzCuzyYb5sZhGTwRiiNjThBxARfVnz ximylT44gTIqzehJIMopQjwSTP24HX/V/u6+jsnF78C2d34BFfLadJ69HuyUQO9coGv0 cA5g== X-Gm-Message-State: AOJu0YwooJMlFTfOlltUwqA7GHkJWhOgUBLneiJmSPnE2WhckW4JHGw8 H5HremOYOZ+Aa3VcHx5r5R2o8asSZZ87DdLnbntOp0ZG27AebdW6Zz1uRv/lQR7hpAaUhQNAj/T 2cmQ2Jk1/k5t7lM7N2eTv5mclwcGqVx0= X-Gm-Gg: AY/fxX44U7snOz9B7XMIUnMLjBUpm7e3Sf3ZpxuzpOohnG4HVwW68jtwc7j9NT2tEg/ J1jMbzhGJi/4fM5H7qjbJ801CjCuOp+s1wbSFdewZ2QdMiK7Qe12xiVLv2XFT7+sqo9zLilvgzX dPkrjDPmREtvHDB07IMKnB/uSbaw8ggzXMUmC1+OHgmgYuqtWr+0F2C8KSeYVl5l7Uo/iFmFpGa /9djIe0oXmUiC4u4fXEzjV/9NDFLfXF13498XBwn/NYRJw8Qb5ohy1q4v8Vg88f4bwzPclS X-Google-Smtp-Source: AGHT+IEZeT2KfS4lrdiBz48AICQV/BU3EZ6suZFWtIvCdPFqI0bwzA3qWjx0hU7iuIxaNpjCjASye08oBvLMk8cep4E= X-Received: by 2002:a05:6820:2223:b0:65d:99e:6533 with SMTP id 006d021491bc7-65d0eb2fc33mr13093507eaf.82.1767057493799; Mon, 29 Dec 2025 17:18:13 -0800 (PST) MIME-Version: 1.0 References: <8254F175-871C-4678-8D28-A67E09B099A6@meddatainc.com> In-Reply-To: From: "David G. Johnston" Date: Mon, 29 Dec 2025 18:17:37 -0700 X-Gm-Features: AQt7F2qauD3fUgHhvWPHeDD37TC8qjReTjHEH2CEPrjDsz3RfgkD7PTjY-bP3Dk Message-ID: Subject: Re: Combining metavariables and table names To: H Cc: PostgreSQL Users Mailing List Content-Type: multipart/alternative; boundary="00000000000037377b064721228b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000037377b064721228b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 29, 2025 at 5:58=E2=80=AFPM H wrote: > Just tried your suggestion to use format() but it resulted in a 'syntax > error at or near "("' > Helps to show exactly what you tried. I provided pseudo-code. postgres=3D# \set sch 'schemaname' postgres=3D# select format('%I.%I', :'sch', 'tblname'); format -------------------- schemaname.tblname (1 row) Admittedly, if the names do require quoting, and depending on how the function uses the value, some additional tweaking may be required. There shouldn't be anything you cannot do with format that you can do with pre-processing and setting the variable up-front. Admittedly that is probably cleaner overall anyway though. David J. --00000000000037377b064721228b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Dec 29, 2025 at 5:58=E2=80=AFPM H <agents@meddatainc.com> wrote:
Just tried your suggestion to use format()= but it resulted in a 'syntax error at or near "("'

Helps to show exactly what you tried.=C2=A0 I = provided pseudo-code.

postgres=3D# \set sch 'sche= maname'
postgres=3D# select format('%I.%I', :'sch', = 'tblname');
=C2=A0 =C2=A0 =C2=A0 =C2=A0format =C2=A0 =C2=A0 =C2= =A0
--------------------
=C2=A0schemaname.tblname
(1 row)

Admittedly, if the names do require quoting, and depending on= how the function uses the value, some additional tweaking may be required.=

There shouldn't be anything you cannot do with fo= rmat that you can do with pre-processing and setting the variable up-front.= =C2=A0 Admittedly that is probably cleaner overall anyway though.
<= br>
David J.

--00000000000037377b064721228b--