Skip to content

Commit 34c6e65

Browse files
committed
Make verify_compact_attribute available in non-assert builds
6f3820f adjusted the assert-enabled validation of the CompactAttribute to call a new external function to perform the validation. That commit made it so the function was only available when building with USE_ASSERT_CHECKING, and because TupleDescCompactAttr() is a static inline function, the call to verify_compact_attribute() was compiled into any extension which uses TupleDescCompactAttr(). This caused issues for such extensions when loading the assert-enabled extension into PostgreSQL versions without asserts enabled due to that function being unavailable in core. To fix this, make verify_compact_attribute() available unconditionally, but make it do nothing unless building with USE_ASSERT_CHECKING. Author: Andrew Kane <andrew@ankane.org> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAOdR5yHfMEMW00XGo=v1zCVUS6Huq2UehXdvKnwtXPTcZwXhmg@mail.gmail.com
1 parent a9dcbb4 commit 34c6e65

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/backend/access/common/tupdesc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ populate_compact_attribute(TupleDesc tupdesc, int attnum)
118118
populate_compact_attribute_internal(src, dst);
119119
}
120120

121-
#ifdef USE_ASSERT_CHECKING
122121
/*
123122
* verify_compact_attribute
124123
* In Assert enabled builds, we verify that the CompactAttribute is
@@ -132,6 +131,7 @@ populate_compact_attribute(TupleDesc tupdesc, int attnum)
132131
void
133132
verify_compact_attribute(TupleDesc tupdesc, int attnum)
134133
{
134+
#ifdef USE_ASSERT_CHECKING
135135
CompactAttribute *cattr = &tupdesc->compact_attrs[attnum];
136136
Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum);
137137
CompactAttribute tmp;
@@ -150,9 +150,8 @@ verify_compact_attribute(TupleDesc tupdesc, int attnum)
150150

151151
/* Check the freshly populated CompactAttribute matches the TupleDesc's */
152152
Assert(memcmp(&tmp, cattr, sizeof(CompactAttribute)) == 0);
153-
}
154153
#endif
155-
154+
}
156155

157156
/*
158157
* CreateTemplateTupleDesc

src/include/access/tupdesc.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ TupleDescAttr(TupleDesc tupdesc, int i)
158158

159159
#undef TupleDescAttrAddress
160160

161-
#ifdef USE_ASSERT_CHECKING
162161
extern void verify_compact_attribute(TupleDesc, int attnum);
163-
#endif
164162

165163
/*
166164
* Accessor for the i'th CompactAttribute element of tupdesc.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy