RE: Bug: ECPG: Cannot use CREATE AS EXECUTE statemnt
От | Matsumura, Ryo |
---|---|
Тема | RE: Bug: ECPG: Cannot use CREATE AS EXECUTE statemnt |
Дата | |
Msg-id | 03040DFF97E6E54E88D3BFEE5F5480F74AC13FBC@G01JPEXMBYT04 обсуждение исходный текст |
Ответ на | Re: Bug: ECPG: Cannot use CREATE AS EXECUTE statemnt (Michael Meskes <meskes@postgresql.org>) |
Список | pgsql-hackers |
Meskes-san Thank you for your comment. I attach a patch. It doesn't include tests, but it passed some test(*1). Explanation about the patch: - Add a new ECPGst_exec_embedded_in_other_stmt whether EXECUTE statement has exprlist or not. This type name may not be good. It is a type for [CREATE TABLE ... AS EXECUTE ...]. But I doesn't consider about [EXPLAIN EXECUTE ...]. - If statement type is a new one, ecpglib embeds variables into query in text format at ecpg_build_params(). Even if the statement does not have exprlist, ecpglib makes exprlist and embeds into it. The list is expanded incrementally in loop of ecpg_build_params(). - ecpg_build_params() is difficult to read and insert the above logic. Therefore, I refactor it. The deitail is described in comments. (*1) The followings run expectively. exec sql create table if not exists foo (c1 int); exec sql insert into foo select generate_series(1, 20); exec sql prepare st as select * from foo where c1 % $1 = 0 and c1 % $2 = 0; exec sql execute st using :v1,:v2; exec sql execute st(:v1,:v2); exec sql create table if not exists bar (c1) as execute st(2, 3); exec sql create table if not exists bar (c1) as execute st using 2,3; exec sql create table if not exists bar (c1) as execute st using :v1,:v2; exec sql create table bar (c1) as execute st using :v1,:v2; Regards Ryo Matsumura
Вложения
В списке pgsql-hackers по дате отправления: