Re: Array elements (urgent help needed)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Akbar Mokhtarani <akbarm(at)slac(dot)stanford(dot)edu>
Cc: PostgreSQL-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Array elements (urgent help needed)
Date: 2004-10-08 17:17:59
Message-ID: 14101.1097255879@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Akbar Mokhtarani <akbarm(at)slac(dot)stanford(dot)edu> writes:

* A standard varlena array has the following internal structure:

This didn't quite agree with what I found but it gave me a starting point.

That's because it's describing the *internal* structure. Since you're
on 7.4, what you are actually seeing is the on-the-wire representation
emitted by array_send(), which looks like:

/* Send the array header information */
pq_sendint(&buf, ndim, 4);
pq_sendint(&buf, v->flags, 4);
pq_sendint(&buf, element_type, sizeof(Oid));
for (i = 0; i < ndim; i++)
{
pq_sendint(&buf, ARR_DIMS(v)[i], 4);
pq_sendint(&buf, ARR_LBOUND(v)[i], 4);
}

/* Send the array elements using the element's own sendproc */
/* (so N element values in whatever the datatype format is) */

regards, tom lane

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tomasz Myrta 2004-10-11 15:58:57 Re: PGacces
Previous Message Akbar Mokhtarani 2004-10-08 17:08:16 Re: Array elements (urgent help needed)