pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gabriele Bartolini <gabriele.bartolini@2ndQuadrant.it>
To: Noah Misch <noah@leadboat.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Marco Nenciarini <marco.nenciarini@2ndquadrant.it>
Subject: Re: [PATCH] Support for foreign keys with arrays
Date: Sat, 10 Dec 2011 09:47:53 +0100
Message-ID: <4EE31CB9.90005@2ndQuadrant.it> (raw)
In-Reply-To: <20111120130526.GD12013@tornado.leadboat.com>
References: <4EB3DF02.4020604@2ndQuadrant.it>
	<20111117042841.GA20517@tornado.leadboat.com>
	<4EC8CA0F.8040405@2ndQuadrant.it>
	<20111120130526.GD12013@tornado.leadboat.com>

Hi Noah,

thanks for your feedback.

Il 20/11/11 14:05, Noah Misch ha scritto:
> What about making ON UPDATE CASCADE an error?  That way, we can say that ARRAY
> <action>  always applies to array elements, and plain<action>  always applies to
> entire rows.
>
> SET DEFAULT should now be fine to allow.  It's ARRAY SET DEFAULT, in your new
> terminology, that wouldn't make sense.

I have tried to gather your ideas with Gianni's and come to a 
compromise, which I hope you can both agree on.

The reason why I would be inclined to leave CASCADE act on rows (rather 
than array elements as Gianni suggests) is for backward compatibility 
(people that are already using referential integrity based on array 
values). For the same reason, I am not sure whether we should raise an 
error on update, but will leave this for later.

So, here is a summary:

--------------- --------- ---------
                |   ON    |   ON    |
Action         | DELETE  | UPDATE  |
--------------- --------- ---------
CASCADE        |   Row   |  Error  |
SET NULL       |   Row   |   Row   |
SET DEFAULT    |   Row   |   Row   |
ARRAY CASCADE  | Element | Element |
ARRAY SET NULL | Element | Element |
NO ACTION      |    -    |    -    |
RESTRICT       |    -    |    -    |
--------------- --------- ---------

If that's fine with you guys, Marco and I will refactor the development 
based on these assumptions.

Thanks,
Gabriele

-- 
  Gabriele Bartolini - 2ndQuadrant Italia
  PostgreSQL Training, Services and Support
  gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it




view thread (62+ messages)  latest in thread

Message-ID: <4EE31CB9.90005@2ndQuadrant.it>
Permalink:  ../4EE31CB9.90005@2ndQuadrant.it/
Also on:    postgresql.org/message-id/4EE31CB9.90005@2ndQuadrant.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: gabriele.bartolini@2ndQuadrant.it, noah@leadboat.com, marco.nenciarini@2ndquadrant.it
  Subject: Re: [PATCH] Support for foreign keys with arrays
  In-Reply-To: <4EE31CB9.90005@2ndQuadrant.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox