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: "pgsql-novice@lists.postgresql.org" <pgsql-novice@lists.postgresql.org>
Date: 2026-06-22T07:46:09Z
Lists: pgsql-novice
Hello,

  I wrote a script to analyze and run vacuum on tables that need it.

Sadly at the time I wrote the script, I never expected a schema name to be pure numbers.

So my Script does not work now.

I want to add double quote marks to each schema name and table name select. I tried using the CONCAT function, but it does not work as I expected it to.

I would be grateful if someone can help me understand the mistake I am making with the CONCAT.

Regards

Ram


The table 7464128.locale_7464128 in database data listening on port 5432 with size 303104 must be vacuumed . It has a XID gap of 5616
Use the command psql -p 5432 -d data -c " vacuum freeze 7464128.locale_7464128"
ERROR:  trailing junk after numeric literal at or near "7464128.locale_7464128"
LINE 1:  vacuum freeze analyze 7464128.locale_7464128


                              ^
data=# \dt *.locale_7464128
              List of relations
Schema  |      Name      | Type  |  Owner
---------+----------------+-------+----------
7464128 | locale_7464128 | table | postgres
(1 row)

data=# vacuum freeze analyze 7464128.locale_7464128 ;
ERROR:  trailing junk after numeric literal at or near "7464128.locale_7464128"
LINE 1: vacuum freeze analyze 7464128.locale_7464128 ;
                              ^
data=# vacuum freeze analyze "7464128"."locale_7464128" ;
VACUUM
data=# \q


#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 \
FROM                                                         \
      pg_class PGCL,                                         \
      information_schema.tables INTB                         \
WHERE                                                        \
     PGCL.relname=INTB.table_name                            \
AND                                                          \
     PGCL.relkind='r'                                       \
AND                                                          \
     age(PGCL.relfrozenxid)  > "$SAFE_XID_GAP" \
ORDER BY                                                    \
        1 DESC ;"


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