| From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
|---|---|
| To: | "Subramanian,Ramachandran" <ramachandran(dot)subramanian(at)alte-leipziger(dot)de> |
| Cc: | "pgsql-novice(at)lists(dot)postgresql(dot)org" <pgsql-novice(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: How to surround a selected value with double quotes? |
| Date: | 2026-06-22 10:09:29 |
| Message-ID: | ajkJ2bj_MRbWpC8C@depesz.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | hubert depesz lubaczewski | 2026-06-22 10:32:21 | Re: How to surround a selected value with double quotes? |
| Previous Message | Subramanian,Ramachandran | 2026-06-22 08:55:48 | AW: How to surround a selected value with double quotes? |