View 'instead of' update row with new object
| От | Tom Dearman |
|---|---|
| Тема | View 'instead of' update row with new object |
| Дата | |
| Msg-id | EE2FCBAC-38D6-4814-BEA4-CBFEE8AC79A8@gmail.com обсуждение исходный текст |
| Список | pgsql-general |
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.
В списке pgsql-general по дате отправления: