AW: How to surround a selected value with double quotes?

Subramanian,Ramachandran <ramachandran.subramanian@alte-leipziger.de>

From: "Subramanian,Ramachandran" <ramachandran.subramanian@alte-leipziger.de>
To: "depesz@depesz.com" <depesz@depesz.com>
Cc: "pgsql-novice@lists.postgresql.org" <pgsql-novice@lists.postgresql.org>
Date: 2026-06-22T10:59:03Z
Lists: pgsql-novice
Hello, 

 thank you for your reply. I tried FORMAT(%I.%I,schema,tablename) and it works too. I have altered my script accordingly. 

Now to the question why CONCAT and || , I am extremely new to Postgres and Linux .I am working on PG/Linux only since Last November. 😊  I come from 30 yrs of working on mainframes ( DB2 / IMS / REXX) and I tend to simply use what works in DB2 and fix only what does not work.  The short answer is , lack of knowledge and experience. 


Thank you so much for taking the time to reply to my question 😊 

LG

Ram 





Freundliche Grüße

i. A. Ramachandran Subramanian
Zentralbereich Informationstechnologie

Alte Leipziger Lebensversicherung a.G.


Hallesche Krankenversicherung a.G.







Alte Leipziger Lebensversicherung a.G., Alte Leipziger-Platz 1, 61440 Oberursel
Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape, Wiltrud Pekarek, Udo Wilcsek
Sitz Oberursel (Taunus) · Rechtsform VVaG · Amtsgericht Bad Homburg v. d. H. HRB 1583 · USt.-IdNr. DE 114106814





 
Hallesche Krankenversicherung a.G.,  Löffelstraße 34-38, 70597 Stuttgart
Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape,
Wiltrud Pekarek, Udo Wilcsek
Sitz Stuttgart · Rechtsform VVaG · Amtsgericht Stuttgart HRB 2686 · USt.-IdNr. DE 147802285
Beiträge zu privaten Kranken- und Pflegekrankenversicherungen unterliegen nicht der Versicherungsteuer (§ 4 Nr. 5 VersStG) · Versicherungsleistungen sowie Umsätze aus Versicherungsvertreter-/Maklertätigkeiten sind umsatzsteuerfrei
 



 
Die Pflichtangaben der ALH Gruppe gemäß § 35a GmbHG bzw. § 80 AktG finden Sie hier: https://www.alte-leipziger.de/impressum 





______________________

ALH Gruppe
Alte Leipziger-Platz 1, 61440 Oberursel
Tel.: +49 (6171) 66-4882
Fax: +49 (6171) 66-800-4882
E-Mail: ramachandran.subramanian@alte-leipziger.de
www.alte-leipziger.de
www.hallesche.de



-----Ursprüngliche Nachricht-----
Von: depesz@depesz.com <depesz@depesz.com> 
Gesendet: Montag, 22. Juni 2026 12:09
An: Subramanian,Ramachandran IT-md-db <ramachandran.subramanian@alte-leipziger.de>
Cc: pgsql-novice@lists.postgresql.org
Betreff: Re: How to surround a selected value with double quotes?

On Mon, Jun 22, 2026 at 07:46:09AM +0000, Subramanian,Ramachandran wrote:
> #Build the SQL needed to get the list of tables that are approaching the SAFE_XID_GAP
> LIST_OLDEST_UNFROZEN_XID_SQL=" SELECT   \
>        cast (age(PGCL.relfrozenxid) as integer) as GAP, \
>        INTB.table_catalog as DB_NAME,   \
>        "$PORT_NO" , \
>        CONCAT('"',INTB.table_schema,'"') || '.' ||  \
>        CONCAT('"',PGCL.relname,'"') as TABLE_NAME,      \
>        pg_table_size(PGCL.oid) as TABLE_SIZE \

*NEVER* concatenate identifiers. It will lead to bugs. Instead use
format() function (I find it MUCH simpler than quote_ident):

In your case, instead of the concat calls (why concat, if you can do ||, anyway?

select
    format('%I.%I', INTB.table_schema, PGCL.relname) FROM …

depesz