Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3gpC-0001Dt-2I for pgsql-sql@arkaria.postgresql.org; Sun, 24 Jan 2021 14:57:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l3gpA-0005Gj-NM for pgsql-sql@arkaria.postgresql.org; Sun, 24 Jan 2021 14:57:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3gpA-0005Gc-GY for pgsql-sql@lists.postgresql.org; Sun, 24 Jan 2021 14:57:08 +0000 Received: from einhorn-mail-out.in-berlin.de ([217.197.80.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3gp8-0006ay-Av for pgsql-sql@lists.postgresql.org; Sun, 24 Jan 2021 14:57:07 +0000 X-Envelope-From: ml@ft-c.de X-Envelope-To: Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 10OEv38W019604 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Sun, 24 Jan 2021 15:57:04 +0100 Message-ID: Subject: format integer From: ml@ft-c.de Reply-To: ml@ft-c.de To: pgsql-sql@lists.postgresql.org Date: Sun, 24 Jan 2021 15:57:02 +0100 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.0 FreeBSD GNOME Team MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, I need a integer format with different decimal places The integer should have 6 diggits. (or 7 or 8) Example (6-diggits) input -> output 123456.789 -> 123456 1234.56789 -> 1234.56 12.3456789 -> 12.3456 but when it is more then 10^6 then 12345678.9 -> 12345678  Is there a pg function for this task? Franz