Search Postgresql Archives

Re: Best way to check if a table is empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sunday, March 23, 2025, Christophe Pettus <xof@xxxxxxxxxxxx> wrote:

(And to be pedantic, #1 returns TRUE / FALSE while #2 returns <int> / NULL, so they aren't exactly equivalent.  If you are able to handle <int> / NULL, you don't need the EXISTS clause.)

Leaving the limit in place, without exists #1 returns either an empty set or an <int>, never NULL.

Always returning a Boolean seems like a better API choice though; but standardizing on that final transform doesn’t change the base comparison.

David J.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux