agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Antonin Houska <[email protected]>
Subject: [PATCH 3/4] Return early from ri_NullCheck() if possible.
Date: Wed, 8 Apr 2020 15:03:20 +0200

---
 src/backend/utils/adt/ri_triggers.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 3bedb75846..93e46ddf7a 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -2541,6 +2541,13 @@ ri_NullCheck(TupleDesc tupDesc,
 			nonenull = false;
 		else
 			allnull = false;
+
+		/*
+		 * If seen both NULL and non-NULL, the next attributes cannot change
+		 * the result.
+		 */
+		if (!nonenull && !allnull)
+			return RI_KEYS_SOME_NULL;
 	}
 
 	if (allnull)
@@ -2549,7 +2556,8 @@ ri_NullCheck(TupleDesc tupDesc,
 	if (nonenull)
 		return RI_KEYS_NONE_NULL;
 
-	return RI_KEYS_SOME_NULL;
+	/* Should not happen. */
+	Assert(false);
 }
 
 
-- 
2.20.1


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=v01-0004-Process-multiple-RI-trigger-events-at-a-time.patch



view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH 3/4] Return early from ri_NullCheck() if possible.
  In-Reply-To: <no-message-id-195303@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox