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 1wbbay-002hUn-0c for pgsql-novice@arkaria.postgresql.org; Mon, 22 Jun 2026 10:09:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wbbax-005xcm-0F for pgsql-novice@arkaria.postgresql.org; Mon, 22 Jun 2026 10:09:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wbbaw-005xce-2Q for pgsql-novice@lists.postgresql.org; Mon, 22 Jun 2026 10:09:34 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wbbau-00000001ZUE-3yyr for pgsql-novice@lists.postgresql.org; Mon, 22 Jun 2026 10:09:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Transfer-Encoding:Content-Type:MIME-Version :References:Reply-To:Message-ID:Subject:Cc:To:Sender:From:Date:Content-ID: Content-Description; bh=7i6Sm6ErPhX4C6u+L+yArIZl72xEX8fgyuT1jREObgQ=; b=dupF/ KyQGoYSxVM7qsgXxKdPWX+0OL13ALJpiC+kT933mhAgQY0szKjn+bCHHL92k5zi24WDp6RaCI7/0o tTHJigO0JdEJpY+FZG61DHDjN7lOoHSZr838jjNO8jboQ9Uyl3Qa7F/kH+UxYVjtLhjb6azeXT2p/ rtaZC02/1bi0=; Received: from depesz by depesz.com with local (Exim 4.98.2) (envelope-from ) id 1wbbar-000000090Ks-2JR9; Mon, 22 Jun 2026 12:09:29 +0200 Date: Mon, 22 Jun 2026 12:09:29 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: "Subramanian,Ramachandran" Cc: "pgsql-novice@lists.postgresql.org" Subject: Re: How to surround a selected value with double quotes? Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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