Re: Assert single row returning SQL-standard functions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assert single row returning SQL-standard functions
Date: 2025-08-29 14:07:39
Message-ID: CAKFQuwZ6d8Btqs8k08c-pny-tPAwpRyHX9ChaVSMzVPEBYgogQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, August 29, 2025, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>
>
> These were just the two first ideas on the top of my head, please share
> yours if you see a better way.
>

I’d love to just add a new clause to select.

Select …
Require {exactly|{more|less}than} row_count

e.g., exactly 1; more than 0, less than 2

No reason to limit this capability to function call outputs especially
since we would like to retain inlining when possible.

For insert/delete/update either add it directly there too or at worse you
get it via returning into a CTE and attaching “require” to the parent query.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2025-08-29 14:08:00 Re: Assert single row returning SQL-standard functions
Previous Message Fabrice Chapuis 2025-08-29 13:58:07 Re: Issue with logical replication slot during switchover