Update using non-existent fields does not throw an error

Поиск
Список
Период
Сортировка
От Rob Richardson
Тема Update using non-existent fields does not throw an error
Дата
Msg-id 67D108EDFAD3C148A593E6ED7DCB4BBD01153EF2B8@RADCONWIN2K8PDC.radcon.local
обсуждение исходный текст
Ответы Re: Update using non-existent fields does not throw an error  (Alban Hertroys <haramrae@gmail.com>)
Re: Update using non-existent fields does not throw an error  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Список pgsql-general

Greetings!

 

An update query is apparently succeeding, even though the query refers to fields that do not exist.  Here’s the query:

 

update inventory set

x_coordinate = (select x_coordinate from bases where base = '101'),

y_coordinate = (select y_coordinate from bases where base = '101')

where charge = 100

 

-- select x_coordinate, y_coordinate from bases where base = '101'

 

When I run the update query, it tells me that the query succeeded and that four records were updated, which is what I expect.  But when I looked at the inventory table, I found that the four records were unchanged.  So, I tried to check the values of the base coordinates by running the select statement shown above.  That statement threw an error complaining that x_coordinate and y_coordinate did not exist.  This is correct; I should have been querying a view that includes those fields.  But why didn’t the update statement throw an error?

 

RobR

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

Предыдущее
От: "Little, Doug C"
Дата:
Сообщение: psql sqlstate return code access
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: Update using non-existent fields does not throw an error