Re: Proposal to provide the facility to set binary format output for specific OID's per session

From: Dave Cramer <davecramer(at)gmail(dot)com>
To: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
Cc: Joe Conway <mail(at)joeconway(dot)com>, Jack Christensen <jack(at)jackchristensen(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal to provide the facility to set binary format output for specific OID's per session
Date: 2022-07-26 12:11:04
Message-ID: CADK3HHJFVS1VWxGDKov8XMeFzyxyGJAyzCRQUwjvso+NMo+ofA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Sehrope,

On Mon, 25 Jul 2022 at 17:53, Dave Cramer <davecramer(at)gmail(dot)com> wrote:

> Hi Sehrope,
>
>
> On Mon, 25 Jul 2022 at 17:22, Sehrope Sarkuni <sehrope(at)jackdb(dot)com> wrote:
>
>> Idea here makes sense and I've seen this brought up repeatedly on the
>> JDBC lists.
>>
>> Does the driver need to be aware that this SET command was executed? I'm
>> wondering what happens if an end user executes this with an OID the driver
>> does not actually know how to handle.
>>
> I suppose there would be a failure to read the attribute correctly.
>
>>
>> > + Oid *tmpOids = palloc(length+1);
>> > ...
>> > + tmpOids = repalloc(tmpOids, length+1);
>>
>> These should be: sizeof(Oid) * (length + 1)
>>
>
> Yes they should, thanks!
>
>>
>> Also, I think you need to specify an explicit context via
>> MemoryContextAlloc or the allocated memory will be in the default context
>> and released at the end of the command.
>>
>
> Also good catch
>
> Thanks,
>

Attached patch to correct these deficiencies.

Thanks again,

>
> Dave
>
>>

Attachment Content-Type Size
0002-allocate-the-correct-amount-of-memory-in-permanent-s.patch application/octet-stream 1.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2022-07-26 12:20:49 Re: Is it correct to say, "invalid data in file \"%s\"", BACKUP_LABEL_FILE in do_pg_backup_stop?
Previous Message Bharath Rupireddy 2022-07-26 11:59:29 Re: Is it correct to say, "invalid data in file \"%s\"", BACKUP_LABEL_FILE in do_pg_backup_stop?