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 1moSzV-0001cN-QZ for pgsql-general@arkaria.postgresql.org; Sat, 20 Nov 2021 16:13:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1moSzU-0006Gu-Mg for pgsql-general@arkaria.postgresql.org; Sat, 20 Nov 2021 16:13:24 +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 1moSzT-0006Gk-CV for pgsql-general@lists.postgresql.org; Sat, 20 Nov 2021 16:13:24 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1moSzO-00044s-KZ for pgsql-general@lists.postgresql.org; Sat, 20 Nov 2021 16:13:22 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 45FE95C0182; Sat, 20 Nov 2021 11:13:15 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 20 Nov 2021 11:13:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=9 yQfbTO60RwPSyZK7UxAEnNSrUHqdK6EgE8sap0LyvE=; b=dNTxo36CzoCcZ85Pw 7rdZQ18KP8KRtcMbKG4PLxfYYrv7GoFFYmmW3cwX/atTl/yMX0XLQ0ZYyXsDJDWQ 9lmhTqhwIgwZfOhgs/d1AoZSmzcyYP3dK1BCoj0j4Fh5lKJa+5uimRYELrbnQOJW Yzea5Nyu8a8GiILJ4jS0+kSwKtO2YmQ7kmdkFwqpRa7Yq9tbGMnY3Tib0OHeSSOV 9Y/KJjC9I0+Rf7jWx7Xd+Tc4qoQ+LnPrn9QgbXh5nVS2GPIWoGyflzd+ShNb+BJx qXUn/yaZ6fMi8claco+dxpUgYv8TB9ARdiblLpWXqhp7lmL86e5JY/fIuInTjzhP oiBxA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=9yQfbTO60RwPSyZK7UxAEnNSrUHqdK6EgE8sap0Ly vE=; b=G6NK1pXp5rSgr5jYXUvicUbAZGmzBT98pL0iNmTNBwm0A3VlkAuw7BOm/ nq/C1SYzAsEWYOBKWFPn1QjmDYgSXzIIZJWNpy/QTxVqjBgdHLh0hkgpom0hkLwJ Gah3PZ4kBLuyg5EOj+BUl8A8WdqvMgy2CklCJRGYZO/HYRumq2E6fOff5NE+oslc SLAvIL2F1ncXQMUHWIA3BV9f901QPgeCXzFMthoXL/uCOLk9QbCQeUte1OlzPLSO KOxF5VvDTS7IaacWm2UWtJIJjf/6qGTKVKErmWMCcAsSWH/9Q1CNpTKcKi4y7KUm oAoM5vdwag+G7j4IXRWIHCsTChlTQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrgedtgdekhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekre dttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeelkeegjefhke etheefudevteehiedvudehkeduleetfedvffeuhedtvdegtdeffeenucffohhmrghinhep phhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtgho mh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 20 Nov 2021 11:13:14 -0500 (EST) Message-ID: <0d15bb84-565a-0246-2b8f-a0e637239339@aklaver.com> Date: Sat, 20 Nov 2021 08:13:13 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1 Subject: Re: insert column monetary type ver 2 Content-Language: en-US To: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JjQstCw0L3QvtCy?= , pgsql-general References: From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 11/20/21 04:45, Дмитрий Иванов wrote: > Good afternoon. > Sorry about the first example. > I can't figure out the problem.  Digit group group separator causes an > insertion error, what should I do? > lc_monetary = 'ru_RU.UTF-8' > Digit group group separator is a space. > Financial type format: 7,649.00 ₽ > DELETE FROM ONLY bpd.class_prop_user_small_val > WHERE id_class_prop = 74502; > Initial version of the data: > INSERT INTO bpd. class_prop_user_small_val (id_class_prop, > timestamp_class, val_int, val_boolean, val_varchar, val_real, > val_numeric, val_date, val_time, val_interval, val_timestamp, val_money, > val_double, max_val, round, id_class, id_data_type, inheritance, > val_bigint, min_val, max_on, min_on, round_on) VALUES (74502, > '2021-09-08 10: 05:12. 618', NULL, NULL, NULL, NULL, NULL, NULL, NULL, > NULL, NULL, '7 649.00 ₽', NULL, -1, 2, 6161, 6, false, 0, -1, false, > false, true); > ---------- > ERROR: invalid input syntax for type money: "7 649,00 ₽" LINE 6: ..., > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '7 649,00 ... > Corrected > INSERT INTO bpd. class_prop_user_small_val (id_class_prop, > timestamp_class, val_int, val_boolean, val_varchar, val_real, > val_numeric, val_date, val_time, val_interval, val_timestamp, val_money, > val_double, max_val, round, id_class, id_data_type, inheritance, > val_bigint, min_val, max_on, min_on, round_on) VALUES (74502, > '2021-09-08 10: 05:12. 618', NULL, NULL, NULL, NULL, NULL, NULL, NULL, > NULL, NULL, '7649.00 ₽', NULL, -1, 2, 6161, 6, false, 0, -1, false, > false, true); > ----------- > INSERT 0 1 > > Why does a financial type conversion with a legal regional digit group > separator cause an error? Because this(cash.c): https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/adt/cash.c;h=d093ce80386f4cf61f3127f3cfe77181f4edfed5;hb=HEAD has this?: /* cash_in() 91 * Convert a string to a cash data type. 92 * Format is [$]###[,]###[.##] 93 * Examples: 123.45 $123.45 $123,456.78 94 * 95 */ The 1000s(group) separator is determined by LC_NUMERIC and I don't believe that is used by the money type. -- Adrian Klaver adrian.klaver@aklaver.com