| From: | Noah Misch <noah(at)leadboat(dot)com> | 
|---|---|
| To: | Robert Haas <robertmhaas(at)gmail(dot)com> | 
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Kouhei Kaigai <kaigai(at)ak(dot)jp(dot)nec(dot)com>, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, Jeff Davis <pgsql(at)j-davis(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: Parallel Seq Scan | 
| Date: | 2015-10-11 23:56:18 | 
| Message-ID: | 20151011235618.GA125073@tornado.leadboat.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On Sat, Sep 26, 2015 at 04:09:12PM -0400, Robert Haas wrote:
> +/*-------------------------------------------------------------------------
> + * datumSerialize
> + *
> + * Serialize a possibly-NULL datum into caller-provided storage.
> +void
> +datumSerialize(Datum value, bool isnull, bool typByVal, int typLen,
> +			   char **start_address)
> +{
> +	int		header;
> +
> +	/* Write header word. */
> +	if (isnull)
> +		header = -2;
> +	else if (typByVal)
> +		header = -1;
> +	else
> +		header = datumGetSize(value, typByVal, typLen);
> +	memcpy(*start_address, &header, sizeof(int));
> +	*start_address += sizeof(int);
> +
> +	/* If not null, write payload bytes. */
> +	if (!isnull)
> +	{
> +		if (typByVal)
> +		{
> +			memcpy(*start_address, &value, sizeof(Datum));
> +			*start_address += sizeof(Datum);
> +		}
> +		else
> +		{
> +			memcpy(*start_address, DatumGetPointer(value), header);
> +			*start_address += header;
> +		}
> +	}
> +}
I see no mention in this thread of varatt_indirect, but I anticipated
datumSerialize() reacting to it the same way datumCopy() reacts.  If
datumSerialize() can get away without doing so, why is that?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Geoghegan | 2015-10-12 00:54:24 | INSERT ... ON CONFLICT documentation clean-up patch | 
| Previous Message | Michael Paquier | 2015-10-11 23:18:45 | Re: Postgres service stops when I kill client backend on Windows |