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.94.2) (envelope-from ) id 1rg9S5-004Tuv-NA for pgsql-general@arkaria.postgresql.org; Fri, 01 Mar 2024 20:25:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rg9S3-00EmY1-BK for pgsql-general@arkaria.postgresql.org; Fri, 01 Mar 2024 20:25:51 +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.94.2) (envelope-from ) id 1rg9S3-00EmXt-0q for pgsql-general@lists.postgresql.org; Fri, 01 Mar 2024 20:25:51 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rg9Rv-002NTy-MJ for pgsql-general@lists.postgresql.org; Fri, 01 Mar 2024 20:25:50 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 421KPZH72985947; Fri, 1 Mar 2024 15:25:35 -0500 From: Tom Lane To: grimy.outshine830@aceecat.org cc: pgsql-general@lists.postgresql.org Subject: Re: Content for talk on Postgres Type System at PostgresConf In-reply-to: References: <08e99a8fa744e063ea31030d6516bfc64c26e3f8.camel@cybertec.at> <372fd5d1-8d7c-411e-8a35-41793978e74b@Spark> <2758726.1709247071@sss.pgh.pa.us> Comments: In-reply-to grimy.outshine830@aceecat.org message dated "Fri, 01 Mar 2024 11:27:29 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2985945.1709324735.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 01 Mar 2024 15:25:35 -0500 Message-ID: <2985946.1709324735@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk grimy.outshine830@aceecat.org writes: > On Thu, Feb 29, 2024 at 05:51:11PM -0500, Tom Lane wrote: >> Yeah. The fact that the same stored value might look like 10.00 >> euros to one session and 1000 yen to another one is pretty >> catastrophic. > But, doesn't what Tom says above contradict Adrian's example session? No, what he showed was correct. I'm talking about a different facet of the problem: postgres=# show lc_monetary; lc_monetary ------------- en_US.utf8 (1 row) postgres=# create table t (m money); CREATE TABLE postgres=# insert into t values('$1000.00'); INSERT 0 1 postgres=# table t; m ----------- $1,000.00 (1 row) postgres=# set lc_monetary = 'ja_JP.utf8'; SET postgres=# table t; m ----------- ¥100,000 (1 row) Even if that took account of the exchange rate, it'd not be great. But it doesn't; it's just the same digits reinterpreted with a new currency sign and possibly a different number of fractional digits. This might be sort of tolerable if your database only ever deals in one currency, but even then you'd likely want to lock down what that currency is. Making it be controlled by a user-set GUC was probably not a great idea. regards, tom lane