Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #13465: multi update query use CTE, result & plan not equal, BUG?
Дата
Msg-id CAKFQuwZ8bYxezWgj=AiouHcLUb80A3wN1zMDkSHxWU-M0EFKaQ@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #13465: multi update query use CTE, result & plan not equal, BUG?  (digoal@126.com)
Список pgsql-bugs
On Wed, Jun 24, 2015 at 8:27 PM, =E5=BE=B7=E5=93=A5 <digoal@126.com> wrote:

> But Why, The same SQL has two diff result?
> It's not a BUG?
>

=E2=80=8BTBH, it might be but the pain I experience in trying to decipher y=
our
example is too great for me to know for sure.

If you cannot simplify it even further I would suggest some improvements.

1. choose better data values and less complexity on the where/joins
2. avoid having CTE names that match up with your table names
3. minimize the table count altogether (i.e, 1) and simply use constants in
your where/joins

Note that #2 above may be why you are confused....

with t(c1,c2) as (update t1 set id=3Dt2.id from t2 where t1.info=3Dt2.info
returning t1.id,t1.info), t2(c3,c4) as (update t1 set info=3Dt3.info from t=
3
where t1.id=3Dt3.id returning t1.id,t1.info) select * from t,t2;

You may also want to write more commentary, especially regarding what you
are expecting versus what you are seeing.

David J.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: getting "ERROR: tuple concurrently updated" during concurrent grant/revoke operations (9.2.13)
Следующее
От: Noah Misch
Дата:
Сообщение: Re: Re: windows 8 RTM compatibility issue (could not reserve shared memory region for child)