Missing conversion error handling in postgres_fdw

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Missing conversion error handling in postgres_fdw
Date: 2016-03-15 08:06:11
Message-ID: 56E7C273.40908@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that this in make_tuple_from_result_row does conversion error
handling only for the ordinary-column case (ie, errpos.cur_attno is set
for that case, but not for the ctid case).

/* convert value to internal representation */
if (i > 0)
{
/* ordinary column */
Assert(i <= tupdesc->natts);
nulls[i - 1] = (valstr == NULL);
/* Apply the input function even to nulls, to support domains */
errpos.cur_attno = i;
values[i - 1] = InputFunctionCall(&attinmeta->attinfuncs[i - 1],
valstr,
attinmeta->attioparams[i - 1],
attinmeta->atttypmods[i - 1]);
errpos.cur_attno = 0;
}
else if (i == SelfItemPointerAttributeNumber)
{
/* ctid --- note we ignore any other system column in result */
if (valstr != NULL)
{
Datum datum;

datum = DirectFunctionCall1(tidin, CStringGetDatum(valstr));
ctid = (ItemPointer) DatumGetPointer(datum);
}
}

I think errpos.cur_attno should be set for the ctid case as well.
Attached is a patch for that.

Best regards,
Etsuro Fujita

Attachment Content-Type Size
postgres-fdw-conv-error-handling.patch application/x-patch 1.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2016-03-15 08:13:13 Re: [PATCH] we have added support for box type in SP-GiST index
Previous Message Amit Langote 2016-03-15 07:48:04 Re: amcheck (B-Tree integrity checking tool)