pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: TalGloz <glozmantal@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Returning Vector of Pairs with a PostgreSQL C Extension Function
Date: Mon, 27 Aug 2018 05:02:24 -0700 (MST)
Message-ID: <1535371344785-0.post@n3.nabble.com> (raw)
In-Reply-To: <15017.1535214682@sss.pgh.pa.us>
References: <1535201678396-0.post@n3.nabble.com>
	<4192.1535211864@sss.pgh.pa.us>
	<1535212627744-0.post@n3.nabble.com>
	<15017.1535214682@sss.pgh.pa.us>

Hello,

I'm having a small problem. The code works but the array cells don't hold
the whole length of *localT1* and *localT2* texts, I think it has something
to do with *int16 typlen* in my set parameters:

ArrayType *array;
Datum elements[2];
int16 typlen;
bool typbyval;
char typalign;

elements[0] = CStringGetDatum(localT1.c_str());
elements[1] = CStringGetDatum(localT2.c_str());

get_typlenbyvalalign(TEXTOID, &typlen, &typbyval, &typalign);
array = construct_array(elements, 2, TEXTOID, typlen, typbyval, typalign);

I can't change the int16 to int32 or int64 because the
get_typlenbyvalalign() function takes an int16. Is there a way to change my
settings so that each input (in this example the *localT1* and *localT2*)
fits fully in each sell?

Best regards,
Tal



--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html




view thread (9+ messages)  latest in thread

Message-ID: <1535371344785-0.post@n3.nabble.com>
Permalink:  ../1535371344785-0.post@n3.nabble.com/
Also on:    postgresql.org/message-id/1535371344785-0.post@n3.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: glozmantal@gmail.com
  Subject: Re: Returning Vector of Pairs with a PostgreSQL C Extension Function
  In-Reply-To: <1535371344785-0.post@n3.nabble.com>
  References: <1535201678396-0.post@n3.nabble.com> <4192.1535211864@sss.pgh.pa.us> <1535212627744-0.post@n3.nabble.com> <15017.1535214682@sss.pgh.pa.us> <1535371344785-0.post@n3.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox