pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
BUG #15256: Comparing if a rowtype is null 2+ messages / 2 participants [nested] [flat]
* BUG #15256: Comparing if a rowtype is null @ 2018-06-29 21:06 PG Bug reporting form <noreply@postgresql.org> 0 siblings, 1 reply; 2+ messages in thread From: PG Bug reporting form @ 2018-06-29 21:06 UTC (permalink / raw) To: pgsql-bugs@lists.postgresql.org; +Cc: anderson.ant.oli@gmail.com The following bug has been logged on the website: Bug reference: 15256 Logged by: Anderson Antunes Email address: anderson.ant.oli@gmail.com PostgreSQL version: 9.3.5 Operating system: Windows Description: Hello. My name is Anderson Antunes. I'm from Brazil. I'd like to get more information about the behavior of the query below using comparison operators. From what I understand in the query result below, a composite type variable is only null when all values are null. Similarly, a variable is not null when all values are not null. However, when we have written a null value and a non-null value, the "is_null" and "is not null" columns remain false. I believe that if we have at least a pre-set value, the operator should recognize that this variable is not null. I hope you have understood what I think. SELECT r, r IS NULL AS "is null", r IS NOT NULL AS "is not null" FROM (VALUES(NULL,NULL), (5, NULL), (5, 5)) r ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #15256: Comparing if a rowtype is null @ 2018-06-29 21:16 David G. Johnston <david.g.johnston@gmail.com> parent: PG Bug reporting form <noreply@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: David G. Johnston @ 2018-06-29 21:16 UTC (permalink / raw) To: Anderson Antunes <anderson.ant.oli@gmail.com>; pgsql-bugs@lists.postgresql.org On Fri, Jun 29, 2018 at 2:06 PM, PG Bug reporting form < noreply@postgresql.org> wrote: > The following bug has been logged on the website: > > Bug reference: 15256 > Logged by: Anderson Antunes > Email address: anderson.ant.oli@gmail.com > PostgreSQL version: 9.3.5 > You should seriously consider upgrading in the near future. > Operating system: Windows > Description: > > Hello. My name is Anderson Antunes. I'm from Brazil. I'd like to get more > information about the behavior of the query below using comparison > operators. From what I understand in the query result below, a composite > type variable is only null when all values are null. Similarly, a variable > is not null when all values are not null. However, when we have written a > null value and a non-null value, the "is_null" and "is not null" columns > remain false. I believe that if we have at least a pre-set value, the > operator should recognize that this variable is not null. > I hope you have understood what I think. > > SELECT > r, > r IS NULL AS "is null", > r IS NOT NULL AS "is not null" > FROM (VALUES(NULL,NULL), (5, NULL), (5, 5)) r > What you wrote is basically what is written in the documentation and by definition documented behavior is not buggy. It is documented that "IS NULL" and "IS NOT NULL" are not inverses of each other when provided a composite types. https://www.postgresql.org/docs/10/static/functions-comparison.html This is not going to change. Write: NOT (composite_type IS NULL) if you need the inverse. David J. ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-06-29 21:16 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-06-29 21:06 BUG #15256: Comparing if a rowtype is null PG Bug reporting form <noreply@postgresql.org> 2018-06-29 21:16 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox