Обсуждение: View 'instead of' update row with new object

Поиск
Список
Период
Сортировка

View 'instead of' update row with new object

От
Tom Dearman
Дата:
I am partitioning a number of tables in our system and am using a view on the real master table with 'instead of’
triggersto insert and update rows.  I have used a view because my application uses Hibernate which does not work well
withtriggers that return a null to indicate no further processing (Hibernate will interpret this as 0 inserts/updates).
This all works well but when using the ‘instead of’ trigger, when a column value is changed, I must write a big clause
withmultiple 'set columnName = NEW.columnName’.  I am also generating the scripts for all tables with a generic
generatorand since the tables have different columns this part of the script must be table specific.  Is there any way
todo something like update tableName * = New.  Or would there be a cost to deleting the row then inserting again - I
haveread that postgres does this anyway, but I assume it may do this in some efficient way which may not require index
updatesetc.