diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-11-08 00:31:03 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2014-11-08 00:31:03 -0300 |
commit | b89ee54e20e722bb91f388667586a2e0986f197b (patch) | |
tree | 896df39d9e413e9cc9b59847a6fa60b84de4b73c /src/backend/access/brin/brin.c | |
parent | 926f5cea472676b8378f02cd80c2c5f86226d981 (diff) | |
download | postgresql-b89ee54e20e722bb91f388667586a2e0986f197b.tar.gz postgresql-b89ee54e20e722bb91f388667586a2e0986f197b.zip |
Fix some coding issues in BRIN
Reported by David Rowley: variadic macros are a problem. Get rid of
them using a trick suggested by Tom Lane: add extra parentheses where
needed. In the future we might decide we don't need the calls at all
and remove them, but it seems appropriate to keep them while this code
is still new.
Also from David Rowley: brininsert() was trying to use a variable before
initializing it. Fix by moving the brin_form_tuple call (which
initializes the variable) to within the locked section.
Reported by Peter Eisentraut: can't use "new" as a struct member name,
because C++ compilers will choke on it, as reported by cpluspluscheck.
Diffstat (limited to 'src/backend/access/brin/brin.c')
-rw-r--r-- | src/backend/access/brin/brin.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index 76cc36c3469..ae655497951 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -247,12 +247,10 @@ brininsert(PG_FUNCTION_ARGS) * the same page though, so downstream we must be prepared to cope * if this turns out to not be possible after all. */ + newtup = brin_form_tuple(bdesc, heapBlk, dtup, &newsz); samepage = brin_can_do_samepage_update(buf, origsz, newsz); - LockBuffer(buf, BUFFER_LOCK_UNLOCK); - newtup = brin_form_tuple(bdesc, heapBlk, dtup, &newsz); - /* * Try to update the tuple. If this doesn't work for whatever * reason, we need to restart from the top; the revmap might be @@ -589,9 +587,10 @@ brinbuildCallback(Relation index, while (thisblock > state->bs_currRangeStart + state->bs_pagesPerRange - 1) { - BRIN_elog(DEBUG2, "brinbuildCallback: completed a range: %u--%u", - state->bs_currRangeStart, - state->bs_currRangeStart + state->bs_pagesPerRange); + BRIN_elog((DEBUG2, + "brinbuildCallback: completed a range: %u--%u", + state->bs_currRangeStart, + state->bs_currRangeStart + state->bs_pagesPerRange)); /* create the index tuple and insert it */ form_and_insert_tuple(state); |