RE: Is PREPARE of ecpglib thread safe?

From: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>
To: 'Kyotaro HORIGUCHI' <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Is PREPARE of ecpglib thread safe?
Date: 2019-03-15 07:43:47
Message-ID: 03040DFF97E6E54E88D3BFEE5F5480F737AC4316@G01JPEXMBYT04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Horiguchi-san, Kuroda-san

> Horiguchi-san wrote:
> > A namespace of declared statement is not connection independent.
> > Therefore, we must manage the namespce in global and consider about race condition.
>
> Right, and but thread independent.

I was wrong. I understand that DECLARE STATEMENT should be same policy as the combination of PREPARE STATEMENT and SET CONNECTION.
We should fix the current implementation of DECLARE STATEMENT.

Current:
t1:Thread1: exec sql at conn1 declare st1 statement;
t2:Thread2: exec sql at conn2 declare st1 statement; // NG

ToBe:
t1:Thread1: exec sql at conn1 declare st1 statement;
t2:Thread2: exec sql at conn2 declare st1 statement; // OK
t3:Thread2: exec sql prepared st1 from "select 1"; // OK: prepared on conn2
t4:Thread1: exec sql execute st1; // NG: not prepared
t5:Thread2: exec sql execute st1; // OK: executed on conn2

t1:Thread1: exec sql at conn1 declare st1 statement;
t2:Thread1: exec sql at conn2 declare st1 statement; // NG

Regards
Ryo Matsumura

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2019-03-15 07:51:37 Re: current_logfiles not following group access and instead follows log_file_mode permissions
Previous Message Heikki Linnakangas 2019-03-15 07:32:22 Re: hyrax vs. RelationBuildPartitionDesc