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 1u7d7u-002oBf-SW for pgsql-general@arkaria.postgresql.org; Wed, 23 Apr 2025 16:39:11 +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 1u7d7t-0080WS-4i for pgsql-general@arkaria.postgresql.org; Wed, 23 Apr 2025 16:39:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u7d7s-0080Vx-Oz for pgsql-general@lists.postgresql.org; Wed, 23 Apr 2025 16:39:09 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u7d7q-001d3u-1U for pgsql-general@postgresql.org; Wed, 23 Apr 2025 16:39:09 +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 53NGd3QL1417514; Wed, 23 Apr 2025 12:39:03 -0400 From: Tom Lane To: Francisco Olarte cc: Abhishek Hatgine , pgsql-general@postgresql.org Subject: Re: Feature Proposal: Column-Level DELETE Operation in SQL In-reply-to: References: Comments: In-reply-to Francisco Olarte message dated "Wed, 23 Apr 2025 17:37:53 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1417512.1745426343.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 23 Apr 2025 12:39:03 -0400 Message-ID: <1417513.1745426343@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Francisco Olarte writes: > On Tue, 22 Apr 2025 at 14:09, Abhishek Hatgine > wrote: >> However, there=E2=80=99s no specific, expressive way to delete the valu= e of a column directly. The typical workaround is to use: >> UPDATE Customers SET Address =3D NULL WHERE CustomerID =3D 103; >> While this works fine, it doesn't semantically express that the develop= er intends to remove the value =E2=80=94 not just update it. > But there is not a concept of removed value in relational. Yeah, that. The entire foundation of SQL, and relational databases in general, is that a table is an array with rows and columns, and there is something in every cell of that array --- maybe only a NULL value, but something. You can't expect to change that without pretty much earth-shattering consequences. As an example, are you suggesting that it should be an error to try to fetch that specific column, but only from that row? There's not a SQL application on the planet that wouldn't be broken by such behavior. I grant that the notion of "no, it's not there" makes sense in some NoSQL applications, and that's fine. But there are reasons why NoSQL is not SQL, and this is one. You can already approximate this sort of behavior in Postgres by storing the less-structured aspects of your data in a JSON or XML column. I'd suggest pursuing that approach rather than trying to get us to mangle fundamental SQL semantics beyond recognition. regards, tom lane