Re: [PG9.1] CTE usage

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Ladislav Lenart <lenartlad(at)volny(dot)cz>
Cc: "List, Postgres" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [PG9.1] CTE usage
Date: 2013-09-16 13:50:46
Message-ID: 52370CB6.8020001@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message damien clochard 2013-09-16 14:10:09 Re: Call for design: PostgreSQL mugs
Previous Message Ladislav Lenart 2013-09-16 13:18:46 Re: [PG9.1] CTE usage