Re: [PROPOSAL]a new data type 'bytea' for ECPG

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>
Cc: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PROPOSAL]a new data type 'bytea' for ECPG
Date: 2019-02-13 12:08:31
Message-ID: 4fed5811ffac55fe01964d6302b5fceb928b802b.camel@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Matsumura-san,

> Current architecture:
> Internal expression of varchar is C-string that includes length
> information implicitly
> because the length can be computed by strlen().
> ECPGdo(ecpg_build_params) assumes that the data in descriptor is C-
> string encoded.
>
> In other hand, bytea data is binary that doesn't include any length
> information.
> And the merit of my proposal is that bytea data can be sent to
> backend without
> C-string encodeing overhead. They are different points from varchar.

Yes, I agree with this. But it does not explain why we cannot just add
a length parameter. And it neither explains why we need so many if
(!bytea) { thisandthat } else { somethingelse } blocks. I would prefer
the integration to be smoother. Hopefully that is possible.

> My Idea-2 is that:
> - ECPGset_desc copies data to descriptor_item.data, set the length to
> dscriptor_item.data_len and set type information to
> descriptor_item.is_binary.
> - ecpg_build_params only memcpy as folowing without ecpg_store_input:
>
> if (descriptor_item.is_binary)
> memcpy(&tobeinserted, descriptor_item.data,
> descriptor_item.data_len)

Isn't that a better way then? This looks more smoothly to me.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-02-13 12:16:07 WAL insert delay settings
Previous Message Thomas Munro 2019-02-13 11:55:59 Re: subscriptionCheck failures on nightjar