Francisco Olarte <folarte@peoplecall.com> writes:
> On Tue, 22 Apr 2025 at 14:09, Abhishek Hatgine
> <hatgineabhishek99@gmail.com> wrote:
>> However, there’s no specific, expressive way to delete the value of a column directly. The typical workaround is to
use:
>> UPDATE Customers SET Address = NULL WHERE CustomerID = 103;
>> While this works fine, it doesn't semantically express that the developer intends to remove the value — not just
updateit.
> 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