Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Alban Hertroys
> On 03 Jan 2015, at 23:14, Rafal Pietrak wrote: >> Well, that’s embarrassing, it’s only a few weeks since I learned this and >> I’m already attributing the theory to the wrong database deity! That’s >> Codd-relationality, of course. Not Boyce. > > The theory got me intrigued. google > (http:

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Rafal Pietrak
A supporting view works OK. - CREATE VIEW api2users AS SELECT * from mailusers; CREATE or replace RULE remove_user AS ON DELETE TO api2users do instead (update mailboxes set username=null where username=old.username and domain=old.domain; delete from mailusers where usern

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Alban Hertroys
> On 03 Jan 2015, at 18:05, Rafal Pietrak wrote: > W dniu 03.01.2015 o 16:48, Alban Hertroys pisze: >>> On 03 Jan 2015, at 15:20, Rafal Pietrak wrote: >>> > [-] >>> Yes. This is precisely the "semantics" I'm trying to put into the schema: >>> after a username is "releas

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Alban Hertroys
> On 03 Jan 2015, at 14:11, Alban Hertroys wrote: > > On 02 Jan 2015, at 13:31, Rafal Pietrak wrote: >> Would it violate SQL standard (signifficantly), if an "on delete set null" >> action just ignored all the FK columns that have a "NOT NULL" constraint set? > > As I understand it, this is p

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Adrian Klaver
On 01/03/2015 09:05 AM, Rafal Pietrak wrote: W dniu 03.01.2015 o 16:48, Alban Hertroys pisze: On 03 Jan 2015, at 15:20, Rafal Pietrak wrote: [-] Yes. This is precisely the "semantics" I'm trying to put into the schema: after a username is "released" from service, all

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Rafal Pietrak
W dniu 03.01.2015 o 16:48, Alban Hertroys pisze: On 03 Jan 2015, at 15:20, Rafal Pietrak wrote: [-] Yes. This is precisely the "semantics" I'm trying to put into the schema: after a username is "released" from service, all it's messages become "from unknown user"

[GENERAL] Replication: How to query current segments allocation relative to "Wal keep segments"?

2015-01-03 Thread Edson Carlos Ericksson Richter
I'm maintaining async replication (streaming) between four database servers arranged on 2 x 2. How to query current segments allocation relative to "Wal keep segments" in each master server? I want to add this query to Postbix in order to monitor if the "wal keep segments" parameter is too shor

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Alban Hertroys
> On 03 Jan 2015, at 15:20, Rafal Pietrak wrote: > > W dniu 03.01.2015 o 14:11, Alban Hertroys pisze: > [--] >> You assumed a functional dependency between username and domain, while those >> fields actually describe independent entities that don’t necessarily go >> together as

Re: [GENERAL] pg_base_backup limit bandwidth possible?

2015-01-03 Thread Edson Carlos Ericksson Richter
At the end, I've chosen to use the following: trickle -u 500 -d 500 rsync --progress --partial -az ${PGDATA}/* r...@xxx.bb.com:/var/lib/pgsql/repl-9.3/data/ --exclude postmaster.pid --exclude postgresql.conf --exclude pg_hba.conf --exclude pg_log and it worked really well. This way I've

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Rafal Pietrak
W dniu 03.01.2015 o 16:07, Adrian Klaver pisze: On 01/03/2015 12:49 AM, Rafal Pietrak wrote: [-] With TRIGGER alone (i.e. without "documenting FK"), one will have to analize the body of an "ever growing" function. Which at certain point would become too much of an effort

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Adrian Klaver
On 01/03/2015 12:49 AM, Rafal Pietrak wrote: W dniu 02.01.2015 o 20:37, Adrian Klaver pisze: On 01/02/2015 08:55 AM, Rafal Pietrak wrote: [--] Is there a way to forcebly push the "old.username=null, throughout the "on-update" FK chains into the all dependent tables, before co

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Rafal Pietrak
W dniu 03.01.2015 o 14:11, Alban Hertroys pisze: [--] You assumed a functional dependency between username and domain, while those fields actually describe independent entities that don’t necessarily go together as you found out. Hence you need to normalise further. For exampl

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Alban Hertroys
On 02 Jan 2015, at 13:31, Rafal Pietrak wrote: > > Hello, > > Rewriting my mail-hub I fell into the following problem: > 1. I have a table with mailmessages, which has an FK to a table of hub users. > 2. I'd like to retain the content of message repository (with it's domain key > not cleared),

Re: [GENERAL] partial "on-delete set null" constraint

2015-01-03 Thread Rafal Pietrak
W dniu 02.01.2015 o 20:37, Adrian Klaver pisze: On 01/02/2015 08:55 AM, Rafal Pietrak wrote: [--] Is there a way to forcebly push the "old.username=null, throughout the "on-update" FK chains into the all dependent tables, before constraints are checked for DELETE operation? I