Thread: Why we don't panic in PageGetExactFreeSpace

Why we don't panic in PageGetExactFreeSpace

From
Zdenek Kotala
Date:
The PageGetExactFreeSpace function contains following code:

00486     space = (int) ((PageHeader) page)->pd_upper -
00487         (int) ((PageHeader) page)->pd_lower;
00488
00489     if (space < 0)
00490         return 0;


It seems to me that we should panic that data are overlaped instead of return 
zero. See PageHeaderIsValid for reference.
Any comments?
    Zdenek

-- 
Zdenek Kotala              Sun Microsystems
Prague, Czech Republic     http://sun.com/postgresql



Re: Why we don't panic in PageGetExactFreeSpace

From
Tom Lane
Date:
Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
> It seems to me that we should panic that data are overlaped instead of return 
> zero.

elog(PANIC) is almost never a good idea, and it certainly isn't a good
response here.
        regards, tom lane


Re: Why we don't panic in PageGetExactFreeSpace

From
Zdenek Kotala
Date:
Tom Lane napsal(a):
> Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
>> It seems to me that we should panic that data are overlaped instead of return 
>> zero.
> 
> elog(PANIC) is almost never a good idea, and it certainly isn't a good
> response here.

Ok PANIC is too strong, but I guess FATAL should be relevant or is there any 
situation when lower > upper? The same situation is in PageGetFreeSpace.
    Zdenek


-- 
Zdenek Kotala              Sun Microsystems
Prague, Czech Republic     http://sun.com/postgresql