Re: BUG #15460: Error while creating index or constraint

From: Peter Geoghegan <pg(at)bowt(dot)ie>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: paul(dot)vanderlinden(at)mapcreator(dot)eu, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Subject: Re: BUG #15460: Error while creating index or constraint
Date: 2018-11-28 19:31:48
Message-ID: CAH2-Wzn0ZNLZs3DhCYdLMv4xn1fnM8ugVHPvWz67dSUh1s_=2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Oct 29, 2018 at 8:25 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> So there are a couple of things to complain about here with respect
> to the error message, regardless of the underlying bug:

Attached patch fixes the problems with BufFileSize(), while also
making similar adjustments to a closely related buffile.c "ereport() +
errcode_for_file_access()" in passing -- the ereport() from
BufFileOpenShared(). Note that both BufFileOpenShared() and
BufFileSize() are used in a closely coordinated way already -- we
literally call one immediately after the other from logtape.c. I don't
like the current inconsistency in error handling.

My approach implies a minor API break in BufFileSize(), but I think
that that's okay -- see the draft commit message for an explanation.
Beyond what I say there, I think that any third party client code
ought to be following the example of tuplestore_rescan(), and seeking
to the end of the BufFile directly. BufFileSize() should just be a
shared BufFile thing, in case it needs to be changed in the future.

--
Peter Geoghegan

Attachment Content-Type Size
0001-Have-BufFileSize-ereport-on-FileSize-failure.patch text/x-patch 3.7 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-11-28 20:49:40 Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error
Previous Message Victor Petrovykh 2018-11-28 18:14:17 Re: BUG #15519: Casting float4 into int4 gets the wrong sign instead of "integer out of range" error