Re: [PATCH] PageGetTempPage cleanup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] PageGetTempPage cleanup
Date: 2008-11-03 20:53:20
Message-ID: 22307.1225745600@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
> I attach patch which cleans up code around PageGetTempPage. These changes were
> discussed here:
> http://archives.postgresql.org/pgsql-hackers/2008-08/msg00102.php

Applied with a minor change: instead of inventing
Page PageGetTempPage(Page page, bool copy)
I split it into two functions
Page PageGetTempPage(Page page)
Page PageGetTempPageCopy(Page page)
I don't see any advantage to having the single function, because it
doesn't seem like any calling code path would be likely to want both
behaviors depending on some condition. Moreover, the way you had it
meant that we'd be replacing
Page PageGetTempPage(Page page, Size specialSize);
with
Page PageGetTempPage(Page page, bool copy);
which seems risky to me. If someone failed to update code that was
meant to call the old API, they'd get no warning about it --- at least
not in any C compiler I'm familiar with. Changing the number of
arguments guarantees a compile error for un-updated code.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-11-03 21:20:47 Re: [SQL] reliable lock inside stored procedure (SOLVED)
Previous Message Andrew Dunstan 2008-11-03 20:47:54 Re: Second thoughts about pg_typeof