Re: Feature Proposal: Column-Level DELETE Operation in SQL - Mailing list pgsql-general

From thombrown1979@duck.com
Subject Re: Feature Proposal: Column-Level DELETE Operation in SQL
Date
Msg-id D42AE092-CBB8-450D-BA3C-54E0914E8344.1@smtp-inbound1.duck.com
Whole thread Raw
In response to Feature Proposal: Column-Level DELETE Operation in SQL  (Abhishek Hatgine <hatgineabhishek99@gmail.com>)
List pgsql-general
On Tue, 22 Apr 2025, 13:09 Abhishek Hatgine,
<hatgineabhishek99_at_gmail.com_thombrown1979@duck.com> wrote:
Dear SQL Development Team,
>
> I hope this message finds you well.
>
> I'd like to propose a new feature for consideration in future versions of SQL — the ability to perform a column-level
DELETEoperation, allowing removal of specific column values without affecting the entire row. 
>
> Proposal Summary
>
> Currently, SQL provides two core commands:
>
> DELETE – to remove entire rows.
>
> UPDATE – to change or nullify column values.
>
> 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. 
>
> Proposed Syntax Examples
>
> Here are some ideas for possible new syntax:
>
>
> DELETE Address FROM Customers WHERE CustomerID = 103;
> -- or
> REMOVE COLUMN Address FROM Customers WHERE CustomerID = 103;
>
> And even:
>
> DELETE Address, PostalCode FROM Customers WHERE Country = 'India';
>
> These would act as a shortcut or expressive alias for setting one or more column values to NULL.
>
> Why This Matters
>
> Improved readability and code clarity.
>
> More intuitive for developers coming from languages or NoSQL systems where fields can be "deleted" from an
object/document.
>
> Emphasizes intent: deleting a value is conceptually different from updating it to NULL.
>
> Opens doors for potential enhancements in tooling and IDE support.
>
> I understand this would require careful consideration within the SQL standards, but I believe it could make SQL more
expressiveand beginner-friendly while preserving its power. 
>
> Thank you for your time and for all the work you do to maintain and improve SQL systems

Hi,

I don't agree that this is intuitive. When you DELETE a row, the row
is gone. The equivalent for columns would be to DROP a column, which
is not the functionality you are asking for. Setting something to NULL
is a perfectly fine operation if you need to unset the value of that
column.

I think what you are proposing would just be syntactic sugar, but is
likely to cause confusion about what exactly it does, and no less
verbose than an explicit UPDATE.

Bear in mind, you also have to contend with default values, NOT NULL
constraints, and foreign key constraints, which further complicate
matters.

Regards

Thom




pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Feature Proposal: Column-Level DELETE Operation in SQL
Next
From: Adrian Klaver
Date:
Subject: Re: Cannot turn track_counts on