Re: storing C binary array in bytea via libpq

From: Tom DalPozzo <t(dot)dalpozzo(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: storing C binary array in bytea via libpq
Date: 2016-12-07 10:10:16
Message-ID: CAK77FCQdbOJEyWU1QJtVYEiZJRhkzP=frUNc=kN-=OVopt5G1Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I tried both ways: they're ok.
Also, multiple VALUES in one INSERT is actually better as performance.

Thanks again
Pupillo

2016-12-06 19:49 GMT+01:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> [ please keep the list cc'd ]
>
> Tom DalPozzo <t(dot)dalpozzo(at)gmail(dot)com> writes:
> > To be honest, I didn't know or I forgot about multiple VALUES in one
> > command! Thanks for reminding!
> > As for the PQexecParams, should I specify something in const Oid
> > *paramTypes parameter? Or just something like $1::bytea?
>
> You can do it either way. Hard-wiring the type OID will be a bit faster
> than making the server parse a ton of repetitive cast constructs, but on
> the other hand it means you have a magic number in your program. It's
> unlikely the OID assigned to bytea would ever change, but the technique
> doesn't scale well to user-defined types. Take your choice.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Torsten Förtsch 2016-12-07 10:21:07 high transaction rate
Previous Message Maeldron T. 2016-12-07 09:40:44 Re: FreeBSD 10 => 11: Dump and reload your PostgreSQL database unless you like it broken