I think there is agreement that the PointerIsValid() macro is pretty useless. This patch proposes to remove it. There have been a few recent mini-discussions in other threads that appear to support this. [0][1]

There were the usual concerns about code churn and backpatching and so on, but I think in the end the change is not that big and it's in pretty boring positions. Also, you can backpatch code without PointerIsValid() just fine. You might run into trouble if you forward-patch. :-/

While converting the code, I tried to find a balance of style of

    if (PointerIsValid(foo))

to

    if (foo)

or

    if (foo != NULL)

but there is no deterministic reason.

(Note that when you convert the first form to the third form, you have to flip the overall sense of the logic, which might look confusing in some places.)


[0]: https://www.postgresql.org/message-id/CA+hUKG+NFKnr=K4oybwDvT35dW=vajaafiulxp+5jezsov3...@mail.gmail.com [1]: https://www.postgresql.org/message-id/[email protected]
From af26264d850a40e5c9c4e73fea81189ca9f6bb6a Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <[email protected]>
Date: Wed, 17 Sep 2025 07:11:05 +0200
Subject: [PATCH] Remove PointerIsValid()

This doesn't provide any value over the standard style of checking the
pointer directly or comparing against NULL.

Also remove related:
- AllocPointerIsValid() [unused]
- IndexScanIsValid() [had one user]
- HeapScanIsValid() [unused]
- InvalidRelation [unused]

Leaving HeapTupleIsValid(), ItemIdIsValid(), PortalIsValid(),
RelationIsValid for now, to reduce code churn.

Discussion: 
https://www.postgresql.org/message-id/CA+hUKG+NFKnr=K4oybwDvT35dW=vajaafiulxp+5jezsov3...@mail.gmail.com
Discussion: 
https://www.postgresql.org/message-id/[email protected]
---
 src/backend/access/common/reloptions.c     |  8 +++---
 src/backend/access/common/tupdesc.c        | 10 +++----
 src/backend/access/index/indexam.c         |  6 ++--
 src/backend/access/transam/xact.c          | 18 ++++++------
 src/backend/catalog/index.c                |  8 +++---
 src/backend/catalog/objectaddress.c        |  2 +-
 src/backend/catalog/pg_proc.c              |  2 +-
 src/backend/catalog/pg_type.c              |  2 +-
 src/backend/commands/foreigncmds.c         | 14 +++++-----
 src/backend/commands/tablecmds.c           |  4 +--
 src/backend/nodes/outfuncs.c               |  2 +-
 src/backend/postmaster/autovacuum.c        |  2 +-
 src/backend/storage/ipc/sinvaladt.c        |  2 +-
 src/backend/storage/large_object/inv_api.c | 14 +++++-----
 src/backend/utils/adt/acl.c                |  2 +-
 src/backend/utils/adt/arrayfuncs.c         |  2 +-
 src/backend/utils/adt/datum.c              |  4 +--
 src/backend/utils/adt/xml.c                |  2 +-
 src/backend/utils/cache/catcache.c         |  2 +-
 src/backend/utils/cache/relcache.c         |  4 +--
 src/backend/utils/cache/syscache.c         | 32 ++++++++--------------
 src/backend/utils/error/assert.c           |  3 +-
 src/backend/utils/mmgr/aset.c              | 10 ++-----
 src/backend/utils/mmgr/bump.c              |  2 +-
 src/backend/utils/mmgr/generation.c        |  4 +--
 src/backend/utils/mmgr/portalmem.c         | 18 ++++++------
 src/backend/utils/mmgr/slab.c              |  4 +--
 src/include/access/genam.h                 |  6 ----
 src/include/access/heapam.h                |  6 ----
 src/include/access/htup.h                  |  2 +-
 src/include/access/itup.h                  |  2 +-
 src/include/c.h                            |  6 ----
 src/include/lib/radixtree.h                |  2 +-
 src/include/storage/itemid.h               |  2 +-
 src/include/storage/itemptr.h              | 14 +++++-----
 src/include/utils/portal.h                 |  2 +-
 src/include/utils/rel.h                    |  4 +--
 37 files changed, 97 insertions(+), 132 deletions(-)

diff --git a/src/backend/access/common/reloptions.c 
b/src/backend/access/common/reloptions.c
index 0af3fea68fa..35150bf237b 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -1179,7 +1179,7 @@ transformRelOptions(Datum oldOptions, List *defList, 
const char *nameSpace,
        astate = NULL;
 
        /* Copy any oldOptions that aren't to be replaced */
-       if (PointerIsValid(DatumGetPointer(oldOptions)))
+       if (DatumGetPointer(oldOptions) != NULL)
        {
                ArrayType  *array = DatumGetArrayTypeP(oldOptions);
                Datum      *oldoptions;
@@ -1357,7 +1357,7 @@ untransformRelOptions(Datum options)
        int                     i;
 
        /* Nothing to do if no options */
-       if (!PointerIsValid(DatumGetPointer(options)))
+       if (DatumGetPointer(options) == NULL)
                return result;
 
        array = DatumGetArrayTypeP(options);
@@ -1549,7 +1549,7 @@ parseRelOptions(Datum options, bool validate, relopt_kind 
kind,
        }
 
        /* Done if no options */
-       if (PointerIsValid(DatumGetPointer(options)))
+       if (DatumGetPointer(options) != NULL)
                parseRelOptionsInternal(options, validate, reloptions, 
numoptions);
 
        *numrelopts = numoptions;
@@ -2092,7 +2092,7 @@ index_reloptions(amoptions_function amoptions, Datum 
reloptions, bool validate)
        Assert(amoptions != NULL);
 
        /* Assume function is strict */
-       if (!PointerIsValid(DatumGetPointer(reloptions)))
+       if (DatumGetPointer(reloptions) == NULL)
                return NULL;
 
        return amoptions(reloptions, validate);
diff --git a/src/backend/access/common/tupdesc.c 
b/src/backend/access/common/tupdesc.c
index 568edacb9bd..d715c345dd8 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -474,8 +474,8 @@ TupleDescCopyEntry(TupleDesc dst, AttrNumber dstAttno,
        /*
         * sanity checks
         */
-       Assert(PointerIsValid(src));
-       Assert(PointerIsValid(dst));
+       Assert(src);
+       Assert(dst);
        Assert(srcAttno >= 1);
        Assert(srcAttno <= src->natts);
        Assert(dstAttno >= 1);
@@ -853,7 +853,7 @@ TupleDescInitEntry(TupleDesc desc,
        /*
         * sanity checks
         */
-       Assert(PointerIsValid(desc));
+       Assert(desc);
        Assert(attributeNumber >= 1);
        Assert(attributeNumber <= desc->natts);
        Assert(attdim >= 0);
@@ -925,7 +925,7 @@ TupleDescInitBuiltinEntry(TupleDesc desc,
        Form_pg_attribute att;
 
        /* sanity checks */
-       Assert(PointerIsValid(desc));
+       Assert(desc);
        Assert(attributeNumber >= 1);
        Assert(attributeNumber <= desc->natts);
        Assert(attdim >= 0);
@@ -1030,7 +1030,7 @@ TupleDescInitEntryCollation(TupleDesc desc,
        /*
         * sanity checks
         */
-       Assert(PointerIsValid(desc));
+       Assert(desc);
        Assert(attributeNumber >= 1);
        Assert(attributeNumber <= desc->natts);
 
diff --git a/src/backend/access/index/indexam.c 
b/src/backend/access/index/indexam.c
index 86d11f4ec79..0492d92d23b 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -75,7 +75,7 @@
 #define RELATION_CHECKS \
 do { \
        Assert(RelationIsValid(indexRelation)); \
-       Assert(PointerIsValid(indexRelation->rd_indam)); \
+       Assert(indexRelation->rd_indam); \
        if 
(unlikely(ReindexIsProcessingIndex(RelationGetRelid(indexRelation)))) \
                ereport(ERROR, \
                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
@@ -85,9 +85,9 @@ do { \
 
 #define SCAN_CHECKS \
 ( \
-       AssertMacro(IndexScanIsValid(scan)), \
+       AssertMacro(scan), \
        AssertMacro(RelationIsValid(scan->indexRelation)), \
-       AssertMacro(PointerIsValid(scan->indexRelation->rd_indam)) \
+       AssertMacro(scan->indexRelation->rd_indam) \
 )
 
 #define CHECK_REL_PROCEDURE(pname) \
diff --git a/src/backend/access/transam/xact.c 
b/src/backend/access/transam/xact.c
index b46e7e9c2a6..2cf3d4e92b7 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -4535,13 +4535,13 @@ ReleaseSavepoint(const char *name)
                        break;
        }
 
-       for (target = s; PointerIsValid(target); target = target->parent)
+       for (target = s; target; target = target->parent)
        {
-               if (PointerIsValid(target->name) && strcmp(target->name, name) 
== 0)
+               if (target->name && strcmp(target->name, name) == 0)
                        break;
        }
 
-       if (!PointerIsValid(target))
+       if (!target)
                ereport(ERROR,
                                (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
                                 errmsg("savepoint \"%s\" does not exist", 
name)));
@@ -4565,7 +4565,7 @@ ReleaseSavepoint(const char *name)
                if (xact == target)
                        break;
                xact = xact->parent;
-               Assert(PointerIsValid(xact));
+               Assert(xact);
        }
 }
 
@@ -4644,13 +4644,13 @@ RollbackToSavepoint(const char *name)
                        break;
        }
 
-       for (target = s; PointerIsValid(target); target = target->parent)
+       for (target = s; target; target = target->parent)
        {
-               if (PointerIsValid(target->name) && strcmp(target->name, name) 
== 0)
+               if (target->name && strcmp(target->name, name) == 0)
                        break;
        }
 
-       if (!PointerIsValid(target))
+       if (!target)
                ereport(ERROR,
                                (errcode(ERRCODE_S_E_INVALID_SPECIFICATION),
                                 errmsg("savepoint \"%s\" does not exist", 
name)));
@@ -4679,7 +4679,7 @@ RollbackToSavepoint(const char *name)
                        elog(FATAL, "RollbackToSavepoint: unexpected state %s",
                                 BlockStateAsString(xact->blockState));
                xact = xact->parent;
-               Assert(PointerIsValid(xact));
+               Assert(xact);
        }
 
        /* And mark the target as "restart pending" */
@@ -5700,7 +5700,7 @@ ShowTransactionStateRec(const char *str, TransactionState 
s)
        ereport(DEBUG5,
                        (errmsg_internal("%s(%d) name: %s; blockState: %s; 
state: %s, xid/subid/cid: %u/%u/%u%s%s",
                                                         str, s->nestingLevel,
-                                                        
PointerIsValid(s->name) ? s->name : "unnamed",
+                                                        s->name ? s->name : 
"unnamed",
                                                         
BlockStateAsString(s->blockState),
                                                         
TransStateAsString(s->state),
                                                         (unsigned int) 
XidFromFullTransactionId(s->fullTransactionId),
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index c4029a4f3d3..5d9db167e59 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -3014,9 +3014,9 @@ index_build(Relation heapRelation,
         * sanity checks
         */
        Assert(RelationIsValid(indexRelation));
-       Assert(PointerIsValid(indexRelation->rd_indam));
-       Assert(PointerIsValid(indexRelation->rd_indam->ambuild));
-       Assert(PointerIsValid(indexRelation->rd_indam->ambuildempty));
+       Assert(indexRelation->rd_indam);
+       Assert(indexRelation->rd_indam->ambuild);
+       Assert(indexRelation->rd_indam->ambuildempty);
 
        /*
         * Determine worker process details for parallel CREATE INDEX.  
Currently,
@@ -3077,7 +3077,7 @@ index_build(Relation heapRelation,
         */
        stats = indexRelation->rd_indam->ambuild(heapRelation, indexRelation,
                                                                                
         indexInfo);
-       Assert(PointerIsValid(stats));
+       Assert(stats);
 
        /*
         * If this is an unlogged index, we may need to write out an init fork 
for
diff --git a/src/backend/catalog/objectaddress.c 
b/src/backend/catalog/objectaddress.c
index 91f3018fd0a..c75b7131ed7 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -4849,7 +4849,7 @@ getObjectIdentityParts(const ObjectAddress *object,
         * will be initialized in all cases inside the switch; but we do it 
anyway
         * so that we can test below that no branch leaves it unset.
         */
-       Assert(PointerIsValid(objname) == PointerIsValid(objargs));
+       Assert((objname != NULL) == (objargs != NULL));
        if (objname)
        {
                *objname = NIL;
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 75b17fed15e..b89b9ccda0e 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -149,7 +149,7 @@ ProcedureCreate(const char *procedureName,
        /*
         * sanity checks
         */
-       Assert(PointerIsValid(prosrc));
+       Assert(prosrc);
 
        parameterCount = parameterTypes->dim1;
        if (parameterCount < 0 || parameterCount > FUNC_MAX_ARGS)
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 3cd9b69edc5..257c7da8568 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -66,7 +66,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid 
ownerId)
        NameData        name;
        ObjectAddress address;
 
-       Assert(PointerIsValid(typeName));
+       Assert(typeName);
 
        /*
         * open pg_type
diff --git a/src/backend/commands/foreigncmds.c 
b/src/backend/commands/foreigncmds.c
index 77f8461f42e..536065dc515 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -632,7 +632,7 @@ CreateForeignDataWrapper(ParseState *pstate, CreateFdwStmt 
*stmt)
                                                                                
 stmt->options,
                                                                                
 fdwvalidator);
 
-       if (PointerIsValid(DatumGetPointer(fdwoptions)))
+       if (DatumGetPointer(fdwoptions) != NULL)
                values[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = 
fdwoptions;
        else
                nulls[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = true;
@@ -783,7 +783,7 @@ AlterForeignDataWrapper(ParseState *pstate, AlterFdwStmt 
*stmt)
                                                                                
stmt->options,
                                                                                
fdwvalidator);
 
-               if (PointerIsValid(DatumGetPointer(datum)))
+               if (DatumGetPointer(datum) != NULL)
                        repl_val[Anum_pg_foreign_data_wrapper_fdwoptions - 1] = 
datum;
                else
                        repl_null[Anum_pg_foreign_data_wrapper_fdwoptions - 1] 
= true;
@@ -943,7 +943,7 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
                                                                                
 stmt->options,
                                                                                
 fdw->fdwvalidator);
 
-       if (PointerIsValid(DatumGetPointer(srvoptions)))
+       if (DatumGetPointer(srvoptions) != NULL)
                values[Anum_pg_foreign_server_srvoptions - 1] = srvoptions;
        else
                nulls[Anum_pg_foreign_server_srvoptions - 1] = true;
@@ -1051,7 +1051,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
                                                                                
stmt->options,
                                                                                
fdw->fdwvalidator);
 
-               if (PointerIsValid(DatumGetPointer(datum)))
+               if (DatumGetPointer(datum) != NULL)
                        repl_val[Anum_pg_foreign_server_srvoptions - 1] = datum;
                else
                        repl_null[Anum_pg_foreign_server_srvoptions - 1] = true;
@@ -1187,7 +1187,7 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
                                                                                
 stmt->options,
                                                                                
 fdw->fdwvalidator);
 
-       if (PointerIsValid(DatumGetPointer(useoptions)))
+       if (DatumGetPointer(useoptions) != NULL)
                values[Anum_pg_user_mapping_umoptions - 1] = useoptions;
        else
                nulls[Anum_pg_user_mapping_umoptions - 1] = true;
@@ -1301,7 +1301,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
                                                                                
stmt->options,
                                                                                
fdw->fdwvalidator);
 
-               if (PointerIsValid(DatumGetPointer(datum)))
+               if (DatumGetPointer(datum) != NULL)
                        repl_val[Anum_pg_user_mapping_umoptions - 1] = datum;
                else
                        repl_null[Anum_pg_user_mapping_umoptions - 1] = true;
@@ -1464,7 +1464,7 @@ CreateForeignTable(CreateForeignTableStmt *stmt, Oid 
relid)
                                                                                
stmt->options,
                                                                                
fdw->fdwvalidator);
 
-       if (PointerIsValid(DatumGetPointer(ftoptions)))
+       if (DatumGetPointer(ftoptions) != NULL)
                values[Anum_pg_foreign_table_ftoptions - 1] = ftoptions;
        else
                nulls[Anum_pg_foreign_table_ftoptions - 1] = true;
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 3be2e051d32..fc89352b661 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -15995,7 +15995,7 @@ ATExecAlterColumnGenericOptions(Relation rel,
                                                                        options,
                                                                        
fdw->fdwvalidator);
 
-       if (PointerIsValid(DatumGetPointer(datum)))
+       if (DatumGetPointer(datum) != NULL)
                repl_val[Anum_pg_attribute_attfdwoptions - 1] = datum;
        else
                repl_null[Anum_pg_attribute_attfdwoptions - 1] = true;
@@ -18673,7 +18673,7 @@ ATExecGenericOptions(Relation rel, List *options)
                                                                        options,
                                                                        
fdw->fdwvalidator);
 
-       if (PointerIsValid(DatumGetPointer(datum)))
+       if (DatumGetPointer(datum) != NULL)
                repl_val[Anum_pg_foreign_table_ftoptions - 1] = datum;
        else
                repl_null[Anum_pg_foreign_table_ftoptions - 1] = true;
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index eaf391fc2ab..d9fe21a07e0 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -363,7 +363,7 @@ outDatum(StringInfo str, Datum value, int typlen, bool 
typbyval)
        else
        {
                s = (char *) DatumGetPointer(value);
-               if (!PointerIsValid(s))
+               if (!s)
                        appendStringInfoString(str, "0 [ ]");
                else
                {
diff --git a/src/backend/postmaster/autovacuum.c 
b/src/backend/postmaster/autovacuum.c
index dce4c8c45b9..fb5d3b27224 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -3107,7 +3107,7 @@ relation_needs_vacanalyze(Oid relid,
         * vacuuming only, so don't vacuum (or analyze) anything that's not 
being
         * forced.
         */
-       if (PointerIsValid(tabentry) && AutoVacuumingActive())
+       if (tabentry && AutoVacuumingActive())
        {
                float4          pcnt_unfrozen = 1;
                float4          reltuples = classForm->reltuples;
diff --git a/src/backend/storage/ipc/sinvaladt.c 
b/src/backend/storage/ipc/sinvaladt.c
index c5748b690f4..d7a845e2c22 100644
--- a/src/backend/storage/ipc/sinvaladt.c
+++ b/src/backend/storage/ipc/sinvaladt.c
@@ -331,7 +331,7 @@ CleanupInvalidationState(int status, Datum arg)
        ProcState  *stateP;
        int                     i;
 
-       Assert(PointerIsValid(segP));
+       Assert(segP);
 
        LWLockAcquire(SInvalWriteLock, LW_EXCLUSIVE);
 
diff --git a/src/backend/storage/large_object/inv_api.c 
b/src/backend/storage/large_object/inv_api.c
index a874000c8ca..f6d2f9dba13 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -298,7 +298,7 @@ inv_open(Oid lobjId, int flags, MemoryContext mcxt)
 void
 inv_close(LargeObjectDesc *obj_desc)
 {
-       Assert(PointerIsValid(obj_desc));
+       Assert(obj_desc);
        pfree(obj_desc);
 }
 
@@ -344,7 +344,7 @@ inv_getsize(LargeObjectDesc *obj_desc)
        SysScanDesc sd;
        HeapTuple       tuple;
 
-       Assert(PointerIsValid(obj_desc));
+       Assert(obj_desc);
 
        open_lo_relation();
 
@@ -389,7 +389,7 @@ inv_seek(LargeObjectDesc *obj_desc, int64 offset, int 
whence)
 {
        int64           newoffset;
 
-       Assert(PointerIsValid(obj_desc));
+       Assert(obj_desc);
 
        /*
         * We allow seek/tell if you have either read or write permission, so no
@@ -436,7 +436,7 @@ inv_seek(LargeObjectDesc *obj_desc, int64 offset, int 
whence)
 int64
 inv_tell(LargeObjectDesc *obj_desc)
 {
-       Assert(PointerIsValid(obj_desc));
+       Assert(obj_desc);
 
        /*
         * We allow seek/tell if you have either read or write permission, so no
@@ -459,7 +459,7 @@ inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
        SysScanDesc sd;
        HeapTuple       tuple;
 
-       Assert(PointerIsValid(obj_desc));
+       Assert(obj_desc);
        Assert(buf != NULL);
 
        if ((obj_desc->flags & IFS_RDLOCK) == 0)
@@ -569,7 +569,7 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int 
nbytes)
        bool            replace[Natts_pg_largeobject];
        CatalogIndexState indstate;
 
-       Assert(PointerIsValid(obj_desc));
+       Assert(obj_desc);
        Assert(buf != NULL);
 
        /* enforce writability because snapshot is probably wrong otherwise */
@@ -760,7 +760,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len)
        bool            replace[Natts_pg_largeobject];
        CatalogIndexState indstate;
 
-       Assert(PointerIsValid(obj_desc));
+       Assert(obj_desc);
 
        /* enforce writability because snapshot is probably wrong otherwise */
        if ((obj_desc->flags & IFS_WRLOCK) == 0)
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index 7dadaefdfc1..fbcd64a2609 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -5159,7 +5159,7 @@ roles_is_member_of(Oid roleid, enum RoleRecurseType type,
        MemoryContext oldctx;
        bloom_filter *bf = NULL;
 
-       Assert(OidIsValid(admin_of) == PointerIsValid(admin_role));
+       Assert(OidIsValid(admin_of) == (admin_role != NULL));
        if (admin_role != NULL)
                *admin_role = InvalidOid;
 
diff --git a/src/backend/utils/adt/arrayfuncs.c 
b/src/backend/utils/adt/arrayfuncs.c
index c833e7df1fd..e5f3e2da35c 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -4601,7 +4601,7 @@ array_create_iterator(ArrayType *arr, int slice_ndim, 
ArrayMetaState *mstate)
        /*
         * Sanity-check inputs --- caller should have got this right already
         */
-       Assert(PointerIsValid(arr));
+       Assert(arr);
        if (slice_ndim < 0 || slice_ndim > ARR_NDIM(arr))
                elog(ERROR, "invalid arguments to array_create_iterator");
 
diff --git a/src/backend/utils/adt/datum.c b/src/backend/utils/adt/datum.c
index 614644a4e2a..c2b111b829e 100644
--- a/src/backend/utils/adt/datum.c
+++ b/src/backend/utils/adt/datum.c
@@ -84,7 +84,7 @@ datumGetSize(Datum value, bool typByVal, int typLen)
                        /* It is a varlena datatype */
                        struct varlena *s = (struct varlena *) 
DatumGetPointer(value);
 
-                       if (!PointerIsValid(s))
+                       if (!s)
                                ereport(ERROR,
                                                
(errcode(ERRCODE_DATA_EXCEPTION),
                                                 errmsg("invalid Datum 
pointer")));
@@ -96,7 +96,7 @@ datumGetSize(Datum value, bool typByVal, int typLen)
                        /* It is a cstring datatype */
                        char       *s = (char *) DatumGetPointer(value);
 
-                       if (!PointerIsValid(s))
+                       if (!s)
                                ereport(ERROR,
                                                
(errcode(ERRCODE_DATA_EXCEPTION),
                                                 errmsg("invalid Datum 
pointer")));
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 7b7396cdf83..66b44183695 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -4895,7 +4895,7 @@ XmlTableSetColumnFilter(TableFuncScanState *state, const 
char *path, int colnum)
        XmlTableBuilderData *xtCxt;
        xmlChar    *xstr;
 
-       Assert(PointerIsValid(path));
+       Assert(path);
 
        xtCxt = GetXmlTableBuilderPrivateData(state, "XmlTableSetColumnFilter");
 
diff --git a/src/backend/utils/cache/catcache.c 
b/src/backend/utils/cache/catcache.c
index e2cd3feaf81..fd1c7be8f53 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -2390,7 +2390,7 @@ PrepareToInvalidateCacheTuple(Relation relation,
         */
        Assert(RelationIsValid(relation));
        Assert(HeapTupleIsValid(tuple));
-       Assert(PointerIsValid(function));
+       Assert(function);
        Assert(CacheHdr != NULL);
 
        reloid = RelationGetRelid(relation);
diff --git a/src/backend/utils/cache/relcache.c 
b/src/backend/utils/cache/relcache.c
index 6fe268a8eec..2b798b823ea 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -2896,7 +2896,7 @@ RelationForgetRelation(Oid rid)
 
        RelationIdCacheLookup(rid, relation);
 
-       if (!PointerIsValid(relation))
+       if (!relation)
                return;                                 /* not in cache, 
nothing to do */
 
        if (!RelationHasReferenceCountZero(relation))
@@ -2941,7 +2941,7 @@ RelationCacheInvalidateEntry(Oid relationId)
 
        RelationIdCacheLookup(relationId, relation);
 
-       if (PointerIsValid(relation))
+       if (relation)
        {
                relcacheInvalsReceived++;
                RelationFlushRelation(relation);
diff --git a/src/backend/utils/cache/syscache.c 
b/src/backend/utils/cache/syscache.c
index 7828bdcba8f..0e70a8020b7 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -131,7 +131,7 @@ InitCatalogCache(void)
                                                                                
 cacheinfo[cacheId].nkeys,
                                                                                
 cacheinfo[cacheId].key,
                                                                                
 cacheinfo[cacheId].nbuckets);
-               if (!PointerIsValid(SysCache[cacheId]))
+               if (!SysCache[cacheId])
                        elog(ERROR, "could not initialize cache %u (%d)",
                                 cacheinfo[cacheId].reloid, cacheId);
                /* Accumulate data for OID lists, too */
@@ -211,8 +211,7 @@ SearchSysCache(int cacheId,
                           Datum key3,
                           Datum key4)
 {
-       Assert(cacheId >= 0 && cacheId < SysCacheSize &&
-                  PointerIsValid(SysCache[cacheId]));
+       Assert(cacheId >= 0 && cacheId < SysCacheSize && SysCache[cacheId]);
 
        return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4);
 }
@@ -221,8 +220,7 @@ HeapTuple
 SearchSysCache1(int cacheId,
                                Datum key1)
 {
-       Assert(cacheId >= 0 && cacheId < SysCacheSize &&
-                  PointerIsValid(SysCache[cacheId]));
+       Assert(cacheId >= 0 && cacheId < SysCacheSize && SysCache[cacheId]);
        Assert(SysCache[cacheId]->cc_nkeys == 1);
 
        return SearchCatCache1(SysCache[cacheId], key1);
@@ -232,8 +230,7 @@ HeapTuple
 SearchSysCache2(int cacheId,
                                Datum key1, Datum key2)
 {
-       Assert(cacheId >= 0 && cacheId < SysCacheSize &&
-                  PointerIsValid(SysCache[cacheId]));
+       Assert(cacheId >= 0 && cacheId < SysCacheSize && SysCache[cacheId]);
        Assert(SysCache[cacheId]->cc_nkeys == 2);
 
        return SearchCatCache2(SysCache[cacheId], key1, key2);
@@ -243,8 +240,7 @@ HeapTuple
 SearchSysCache3(int cacheId,
                                Datum key1, Datum key2, Datum key3)
 {
-       Assert(cacheId >= 0 && cacheId < SysCacheSize &&
-                  PointerIsValid(SysCache[cacheId]));
+       Assert(cacheId >= 0 && cacheId < SysCacheSize && SysCache[cacheId]);
        Assert(SysCache[cacheId]->cc_nkeys == 3);
 
        return SearchCatCache3(SysCache[cacheId], key1, key2, key3);
@@ -254,8 +250,7 @@ HeapTuple
 SearchSysCache4(int cacheId,
                                Datum key1, Datum key2, Datum key3, Datum key4)
 {
-       Assert(cacheId >= 0 && cacheId < SysCacheSize &&
-                  PointerIsValid(SysCache[cacheId]));
+       Assert(cacheId >= 0 && cacheId < SysCacheSize && SysCache[cacheId]);
        Assert(SysCache[cacheId]->cc_nkeys == 4);
 
        return SearchCatCache4(SysCache[cacheId], key1, key2, key3, key4);
@@ -607,13 +602,12 @@ SysCacheGetAttr(int cacheId, HeapTuple tup,
         * valid (because the caller recently fetched the tuple via this same
         * cache), but there are cases where we have to initialize the cache 
here.
         */
-       if (cacheId < 0 || cacheId >= SysCacheSize ||
-               !PointerIsValid(SysCache[cacheId]))
+       if (cacheId < 0 || cacheId >= SysCacheSize || !SysCache[cacheId])
                elog(ERROR, "invalid cache ID: %d", cacheId);
-       if (!PointerIsValid(SysCache[cacheId]->cc_tupdesc))
+       if (!SysCache[cacheId]->cc_tupdesc)
        {
                InitCatCachePhase2(SysCache[cacheId], false);
-               Assert(PointerIsValid(SysCache[cacheId]->cc_tupdesc));
+               Assert(SysCache[cacheId]->cc_tupdesc);
        }
 
        return heap_getattr(tup, attributeNumber,
@@ -664,8 +658,7 @@ GetSysCacheHashValue(int cacheId,
                                         Datum key3,
                                         Datum key4)
 {
-       if (cacheId < 0 || cacheId >= SysCacheSize ||
-               !PointerIsValid(SysCache[cacheId]))
+       if (cacheId < 0 || cacheId >= SysCacheSize || !SysCache[cacheId])
                elog(ERROR, "invalid cache ID: %d", cacheId);
 
        return GetCatCacheHashValue(SysCache[cacheId], key1, key2, key3, key4);
@@ -678,8 +671,7 @@ struct catclist *
 SearchSysCacheList(int cacheId, int nkeys,
                                   Datum key1, Datum key2, Datum key3)
 {
-       if (cacheId < 0 || cacheId >= SysCacheSize ||
-               !PointerIsValid(SysCache[cacheId]))
+       if (cacheId < 0 || cacheId >= SysCacheSize || !SysCache[cacheId])
                elog(ERROR, "invalid cache ID: %d", cacheId);
 
        return SearchCatCacheList(SysCache[cacheId], nkeys,
@@ -701,7 +693,7 @@ SysCacheInvalidate(int cacheId, uint32 hashValue)
                elog(ERROR, "invalid cache ID: %d", cacheId);
 
        /* if this cache isn't initialized yet, no need to do anything */
-       if (!PointerIsValid(SysCache[cacheId]))
+       if (!SysCache[cacheId])
                return;
 
        CatCacheInvalidate(SysCache[cacheId], hashValue);
diff --git a/src/backend/utils/error/assert.c b/src/backend/utils/error/assert.c
index 84b94f5e5f4..9dbd9efe41a 100644
--- a/src/backend/utils/error/assert.c
+++ b/src/backend/utils/error/assert.c
@@ -32,8 +32,7 @@ ExceptionalCondition(const char *conditionName,
                                         int lineNumber)
 {
        /* Report the failure on stderr (or local equivalent) */
-       if (!PointerIsValid(conditionName)
-               || !PointerIsValid(fileName))
+       if (!conditionName || !fileName)
                write_stderr("TRAP: ExceptionalCondition: bad arguments in PID 
%d\n",
                                         (int) getpid());
        else
diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c
index 9ef109ca586..d5ae1bdd3cd 100644
--- a/src/backend/utils/mmgr/aset.c
+++ b/src/backend/utils/mmgr/aset.c
@@ -189,25 +189,19 @@ typedef struct AllocBlockData
        char       *endptr;                     /* end of space in this block */
 }                      AllocBlockData;
 
-/*
- * AllocPointerIsValid
- *             True iff pointer is valid allocation pointer.
- */
-#define AllocPointerIsValid(pointer) PointerIsValid(pointer)
-
 /*
  * AllocSetIsValid
  *             True iff set is valid allocation set.
  */
 #define AllocSetIsValid(set) \
-       (PointerIsValid(set) && IsA(set, AllocSetContext))
+       ((set) && IsA(set, AllocSetContext))
 
 /*
  * AllocBlockIsValid
  *             True iff block is valid block of allocation set.
  */
 #define AllocBlockIsValid(block) \
-       (PointerIsValid(block) && AllocSetIsValid((block)->aset))
+       ((block) && AllocSetIsValid((block)->aset))
 
 /*
  * We always store external chunks on a dedicated block.  This makes fetching
diff --git a/src/backend/utils/mmgr/bump.c b/src/backend/utils/mmgr/bump.c
index 2805d55a2ec..a263861fe43 100644
--- a/src/backend/utils/mmgr/bump.c
+++ b/src/backend/utils/mmgr/bump.c
@@ -100,7 +100,7 @@ struct BumpBlock
  *             True iff set is valid bump context.
  */
 #define BumpIsValid(set) \
-       (PointerIsValid(set) && IsA(set, BumpContext))
+       ((set) && IsA(set, BumpContext))
 
 /*
  * We always store external chunks on a dedicated block.  This makes fetching
diff --git a/src/backend/utils/mmgr/generation.c 
b/src/backend/utils/mmgr/generation.c
index cfafc9bf082..f6203501956 100644
--- a/src/backend/utils/mmgr/generation.c
+++ b/src/backend/utils/mmgr/generation.c
@@ -102,14 +102,14 @@ struct GenerationBlock
  *             True iff set is valid generation set.
  */
 #define GenerationIsValid(set) \
-       (PointerIsValid(set) && IsA(set, GenerationContext))
+       ((set) && IsA(set, GenerationContext))
 
 /*
  * GenerationBlockIsValid
  *             True iff block is valid block of generation set.
  */
 #define GenerationBlockIsValid(block) \
-       (PointerIsValid(block) && GenerationIsValid((block)->context))
+       ((block) && GenerationIsValid((block)->context))
 
 /*
  * GenerationBlockIsEmpty
diff --git a/src/backend/utils/mmgr/portalmem.c 
b/src/backend/utils/mmgr/portalmem.c
index 0be1c2b0fff..943da087c9f 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -131,7 +131,7 @@ GetPortalByName(const char *name)
 {
        Portal          portal;
 
-       if (PointerIsValid(name))
+       if (name)
                PortalHashTableLookup(name, portal);
        else
                portal = NULL;
@@ -176,7 +176,7 @@ CreatePortal(const char *name, bool allowDup, bool 
dupSilent)
 {
        Portal          portal;
 
-       Assert(PointerIsValid(name));
+       Assert(name);
 
        portal = GetPortalByName(name);
        if (PortalIsValid(portal))
@@ -425,7 +425,7 @@ MarkPortalDone(Portal portal)
         * aborted transaction, this is necessary, or we'd reach 
AtCleanup_Portals
         * with the cleanup hook still unexecuted.
         */
-       if (PointerIsValid(portal->cleanup))
+       if (portal->cleanup)
        {
                portal->cleanup(portal);
                portal->cleanup = NULL;
@@ -453,7 +453,7 @@ MarkPortalFailed(Portal portal)
         * is necessary, or we'd reach AtCleanup_Portals with the cleanup hook
         * still unexecuted.
         */
-       if (PointerIsValid(portal->cleanup))
+       if (portal->cleanup)
        {
                portal->cleanup(portal);
                portal->cleanup = NULL;
@@ -497,7 +497,7 @@ PortalDrop(Portal portal, bool isTopCommit)
         * Note: in most paths of control, this will have been done already in
         * MarkPortalDone or MarkPortalFailed.  We're just making sure.
         */
-       if (PointerIsValid(portal->cleanup))
+       if (portal->cleanup)
        {
                portal->cleanup(portal);
                portal->cleanup = NULL;
@@ -823,7 +823,7 @@ AtAbort_Portals(void)
                 * Allow portalcmds.c to clean up the state it knows about, if 
we
                 * haven't already.
                 */
-               if (PointerIsValid(portal->cleanup))
+               if (portal->cleanup)
                {
                        portal->cleanup(portal);
                        portal->cleanup = NULL;
@@ -896,7 +896,7 @@ AtCleanup_Portals(void)
                 * We had better not call any user-defined code during cleanup, 
so if
                 * the cleanup hook hasn't been run yet, too bad; we'll just 
skip it.
                 */
-               if (PointerIsValid(portal->cleanup))
+               if (portal->cleanup)
                {
                        elog(WARNING, "skipping cleanup for portal \"%s\"", 
portal->name);
                        portal->cleanup = NULL;
@@ -1056,7 +1056,7 @@ AtSubAbort_Portals(SubTransactionId mySubid,
                 * Allow portalcmds.c to clean up the state it knows about, if 
we
                 * haven't already.
                 */
-               if (PointerIsValid(portal->cleanup))
+               if (portal->cleanup)
                {
                        portal->cleanup(portal);
                        portal->cleanup = NULL;
@@ -1115,7 +1115,7 @@ AtSubCleanup_Portals(SubTransactionId mySubid)
                 * We had better not call any user-defined code during cleanup, 
so if
                 * the cleanup hook hasn't been run yet, too bad; we'll just 
skip it.
                 */
-               if (PointerIsValid(portal->cleanup))
+               if (portal->cleanup)
                {
                        elog(WARNING, "skipping cleanup for portal \"%s\"", 
portal->name);
                        portal->cleanup = NULL;
diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c
index 0e35abcf5a0..0bb96187603 100644
--- a/src/backend/utils/mmgr/slab.c
+++ b/src/backend/utils/mmgr/slab.c
@@ -193,14 +193,14 @@ typedef struct SlabBlock
  * SlabIsValid
  *             True iff set is a valid slab allocation set.
  */
-#define SlabIsValid(set) (PointerIsValid(set) && IsA(set, SlabContext))
+#define SlabIsValid(set) ((set) && IsA(set, SlabContext))
 
 /*
  * SlabBlockIsValid
  *             True iff block is a valid block of slab allocation set.
  */
 #define SlabBlockIsValid(block) \
-       (PointerIsValid(block) && SlabIsValid((block)->slab))
+       ((block) && SlabIsValid((block)->slab))
 
 /*
  * SlabBlocklistIndex
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index 5b2ab181b5f..0831c33b038 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -155,12 +155,6 @@ typedef struct IndexOrderByDistance
  * generalized index_ interface routines (in indexam.c)
  */
 
-/*
- * IndexScanIsValid
- *             True iff the index scan is valid.
- */
-#define IndexScanIsValid(scan) PointerIsValid(scan)
-
 extern Relation index_open(Oid relationId, LOCKMODE lockmode);
 extern Relation try_index_open(Oid relationId, LOCKMODE lockmode);
 extern void index_close(Relation relation, LOCKMODE lockmode);
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index a2bd5a897f8..a1de400b9a5 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -280,12 +280,6 @@ typedef enum
  */
 
 
-/*
- * HeapScanIsValid
- *             True iff the heap scan is valid.
- */
-#define HeapScanIsValid(scan) PointerIsValid(scan)
-
 extern TableScanDesc heap_beginscan(Relation relation, Snapshot snapshot,
                                                                        int 
nkeys, ScanKey key,
                                                                        
ParallelTableScanDesc parallel_scan,
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index f0e3aa87dc3..f6b766697e2 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -75,7 +75,7 @@ typedef HeapTupleData *HeapTuple;
 /*
  * Accessor macros to be used with HeapTuple pointers.
  */
-#define HeapTupleIsValid(tuple) PointerIsValid(tuple)
+#define HeapTupleIsValid(tuple) ((tuple) != NULL)
 
 /* HeapTupleHeader functions implemented in utils/time/combocid.c */
 extern CommandId HeapTupleHeaderGetCmin(const HeapTupleHeaderData *tup);
diff --git a/src/include/access/itup.h b/src/include/access/itup.h
index 338e90749bd..4ba928c7132 100644
--- a/src/include/access/itup.h
+++ b/src/include/access/itup.h
@@ -131,7 +131,7 @@ IndexInfoFindDataOffset(unsigned short t_info)
 static inline Datum
 index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
 {
-       Assert(PointerIsValid(isnull));
+       Assert(isnull);
        Assert(attnum > 0);
 
        *isnull = false;
diff --git a/src/include/c.h b/src/include/c.h
index f303ba0605a..bc6f8ed2882 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -735,12 +735,6 @@ typedef NameData *Name;
  */
 #define BoolIsValid(boolean)   ((boolean) == false || (boolean) == true)
 
-/*
- * PointerIsValid
- *             True iff pointer is valid.
- */
-#define PointerIsValid(pointer) ((const void*)(pointer) != NULL)
-
 /*
  * PointerIsAligned
  *             True iff pointer is properly aligned to point to the given type.
diff --git a/src/include/lib/radixtree.h b/src/include/lib/radixtree.h
index a75b77270c4..ead7500fe13 100644
--- a/src/include/lib/radixtree.h
+++ b/src/include/lib/radixtree.h
@@ -403,7 +403,7 @@ typedef struct RT_NODE
 #else
 #define RT_PTR_ALLOC RT_NODE *
 #define RT_INVALID_PTR_ALLOC NULL
-#define RT_PTR_ALLOC_IS_VALID(ptr) PointerIsValid(ptr)
+#define RT_PTR_ALLOC_IS_VALID(ptr) ((ptr) != NULL)
 #endif
 
 /*
diff --git a/src/include/storage/itemid.h b/src/include/storage/itemid.h
index bfefacaab5c..bbe48aa7322 100644
--- a/src/include/storage/itemid.h
+++ b/src/include/storage/itemid.h
@@ -83,7 +83,7 @@ typedef uint16 ItemLength;
  *             True iff item identifier is valid.
  *             This is a pretty weak test, probably useful only in Asserts.
  */
-#define ItemIdIsValid(itemId)  PointerIsValid(itemId)
+#define ItemIdIsValid(itemId)  ((itemId) != NULL)
 
 /*
  * ItemIdIsUsed
diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h
index 74b87a9114a..2e251fb64ed 100644
--- a/src/include/storage/itemptr.h
+++ b/src/include/storage/itemptr.h
@@ -82,7 +82,7 @@ typedef ItemPointerData *ItemPointer;
 static inline bool
 ItemPointerIsValid(const ItemPointerData *pointer)
 {
-       return PointerIsValid(pointer) && pointer->ip_posid != 0;
+       return pointer && pointer->ip_posid != 0;
 }
 
 /*
@@ -134,7 +134,7 @@ ItemPointerGetOffsetNumber(const ItemPointerData *pointer)
 static inline void
 ItemPointerSet(ItemPointerData *pointer, BlockNumber blockNumber, OffsetNumber 
offNum)
 {
-       Assert(PointerIsValid(pointer));
+       Assert(pointer);
        BlockIdSet(&pointer->ip_blkid, blockNumber);
        pointer->ip_posid = offNum;
 }
@@ -146,7 +146,7 @@ ItemPointerSet(ItemPointerData *pointer, BlockNumber 
blockNumber, OffsetNumber o
 static inline void
 ItemPointerSetBlockNumber(ItemPointerData *pointer, BlockNumber blockNumber)
 {
-       Assert(PointerIsValid(pointer));
+       Assert(pointer);
        BlockIdSet(&pointer->ip_blkid, blockNumber);
 }
 
@@ -157,7 +157,7 @@ ItemPointerSetBlockNumber(ItemPointerData *pointer, 
BlockNumber blockNumber)
 static inline void
 ItemPointerSetOffsetNumber(ItemPointerData *pointer, OffsetNumber offsetNumber)
 {
-       Assert(PointerIsValid(pointer));
+       Assert(pointer);
        pointer->ip_posid = offsetNumber;
 }
 
@@ -171,8 +171,8 @@ ItemPointerSetOffsetNumber(ItemPointerData *pointer, 
OffsetNumber offsetNumber)
 static inline void
 ItemPointerCopy(const ItemPointerData *fromPointer, ItemPointerData *toPointer)
 {
-       Assert(PointerIsValid(toPointer));
-       Assert(PointerIsValid(fromPointer));
+       Assert(toPointer);
+       Assert(fromPointer);
        *toPointer = *fromPointer;
 }
 
@@ -183,7 +183,7 @@ ItemPointerCopy(const ItemPointerData *fromPointer, 
ItemPointerData *toPointer)
 static inline void
 ItemPointerSetInvalid(ItemPointerData *pointer)
 {
-       Assert(PointerIsValid(pointer));
+       Assert(pointer);
        BlockIdSet(&pointer->ip_blkid, InvalidBlockNumber);
        pointer->ip_posid = InvalidOffsetNumber;
 }
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index 0b62143af8b..5ffa6fd5cc8 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -208,7 +208,7 @@ typedef struct PortalData
  * PortalIsValid
  *             True iff portal is valid.
  */
-#define PortalIsValid(p) PointerIsValid(p)
+#define PortalIsValid(p) ((p) != NULL)
 
 
 /* Prototypes for functions in utils/mmgr/portalmem.c */
diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h
index b552359915f..21990436373 100644
--- a/src/include/utils/rel.h
+++ b/src/include/utils/rel.h
@@ -486,9 +486,7 @@ typedef struct ViewOptions
  * RelationIsValid
  *             True iff relation descriptor is valid.
  */
-#define RelationIsValid(relation) PointerIsValid(relation)
-
-#define InvalidRelation ((Relation) NULL)
+#define RelationIsValid(relation) ((relation) != NULL)
 
 /*
  * RelationHasReferenceCountZero

base-commit: 0951942bba25f85ad29a4f096ed51a356652b5a2
-- 
2.51.0

Reply via email to