Re: funny update, say update 1, changed 2 records.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: funny update, say update 1, changed 2 records.
Дата
Msg-id 12097.1118510961@sss.pgh.pa.us
обсуждение исходный текст
Ответ на funny update, say update 1, changed 2 records.  (Neil Dugan <postgres@butterflystitches.com.au>)
Ответы Re: funny update, say update 1, changed 2 records.  (Neil Dugan <postgres@butterflystitches.com.au>)
Список pgsql-general
Neil Dugan <postgres@butterflystitches.com.au> writes:
> I have been having some trouble with a particular table view.  An UPDATE
> command is not only changing the applicable record it is also creating a
> new record as well.

I think it's because your UPDATE is updating supplier.account_type which
is part of the join key for the view's underlying join.  Somehow that
results in the update applying to all supplier rows that join to the
same account_type row.  Don't have time now to work out exactly why ...
but the easiest solution is probably to not use a join in the view.
Instead fetch the account_type.name via a subselect in the view's
output list.

            regards, tom lane

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

Предыдущее
От: Hugo
Дата:
Сообщение: Re: how to return a result set from a stored procedure
Следующее
От: "Ed L."
Дата:
Сообщение: memory question