Re: [Review] Add SPI_gettypmod() to return a field's typemod from a TupleDesc

From: Mark Wong <markwkm(at)gmail(dot)com>
To: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Chetan Suttraway <chetan(dot)suttraway(at)enterprisedb(dot)com>
Subject: Re: [Review] Add SPI_gettypmod() to return a field's typemod from a TupleDesc
Date: 2013-06-26 02:19:58
Message-ID: CAE+TzGotgnfUDMCG13EMJ5t-Y+F1y9N=3NzJ4pPN-XJ8pnAHHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 25, 2013 at 1:38 AM, Jeevan Chalke
<jeevan(dot)chalke(at)enterprisedb(dot)com> wrote:
> Hi Mark,
>
> Is this the latest patch you are targeting for 9.4 CF1 ?
>
> I am going to review it.
>
> From the comment, here is one issue you need to resolve first:
>
> *************** exec_eval_datum(PLpgSQL_execstate *estat
> *** 4386,4396 ****
> errmsg("record \"%s\" has no field \"%s\"",
> rec->refname, recfield->fieldname)));
> *typeid = SPI_gettypeid(rec->tupdesc, fno);
> ! /* XXX there's no SPI_gettypmod, for some reason */
> ! if (fno > 0)
> ! *typetypmod = rec->tupdesc->attrs[fno - 1]->atttypmod;
> ! else
> ! *typetypmod = -1;
> *value = SPI_getbinval(rec->tup, rec->tupdesc, fno,
> isnull);
> break;
> }
> --- 4386,4392 ----
> errmsg("record \"%s\" has no field \"%s\"",
> rec->refname, recfield->fieldname)));
> *typeid = SPI_gettypeid(rec->tupdesc, fno);
> ! *typetypmod = SPI_gettypeid(rec->tupdesc, fno);
> *value = SPI_getbinval(rec->tup, rec->tupdesc, fno,
> isnull);
> break;
> }
>
>
> Once you confirm, I will go ahead reviewing it.

Hi Jeevan,

Oopsies, I've updated the patch and attached it.

Regards,
Mark

Attachment Content-Type Size
add_spigettypmod-20130625.diff application/octet-stream 5.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2013-06-26 02:47:40 Re: Patch to add regression tests for SCHEMA
Previous Message Kyotaro HORIGUCHI 2013-06-26 02:10:15 Re: Reduce maximum error in tuples estimation after vacuum.