Re: [PG9.1] CTE usage
От | Adrian Klaver |
---|---|
Тема | Re: [PG9.1] CTE usage |
Дата | |
Msg-id | 52370CB6.8020001@gmail.com обсуждение исходный текст |
Ответ на | Re: [PG9.1] CTE usage (Ladislav Lenart <lenartlad@volny.cz>) |
Ответы |
Re: [PG9.1] CTE usage
|
Список | pgsql-general |
On 09/16/2013 04:57 AM, Ladislav Lenart wrote: > On 16.9.2013 13:26, Alban Hertroys wrote: >> >> Wouldn't it be much easier to define an FK constraint with ON DELETE CASCADE? >> With that, you only need to worry about which rows you delete from the >> parent table and dependant children will be removed automatically. > > > Hello. > > I don't quite follow. Having item.item_type1_id FK with ON DELETE CASCADE would > delete ITEM (the parent) when ITEM_TYPE1 (the child) is deleted. You suggests > the opposite direction. http://www.postgresql.org/docs/9.3/interactive/sql-createtable.html "..In addition, when the data in the referenced columns is changed, certain actions are performed on the data in this table's columns. The ON DELETE clause specifies the action to perform when a referenced row in the referenced table is being deleted. .." "..CASCADE Delete any rows referencing the deleted row, or update the values of the referencing column(s) to the new values of the referenced columns, respectively. .." -- Adrian Klaver adrian.klaver@gmail.com
В списке pgsql-general по дате отправления: