Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Neil Dugan <postgres@xxxxxxxxxxxxxxxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux