Re: Peer-review requested of soft-delete scheme - Mailing list pgsql-sql

From Jasen Betts
Subject Re: Peer-review requested of soft-delete scheme
Date
Msg-id kkomb9$skn$2@gonzo.reversiblemaps.ath.cx
Whole thread Raw
In response to Peer-review requested of soft-delete scheme  (Mark Stosberg <mark@summersault.com>)
List pgsql-sql
On 2013-04-16, Mark Stosberg <mark@summersault.com> wrote:

> My challenge is that I want to make very hard or impossible to access
> the soft-deleted rows through SELECT statements. There are lots of
> selects statements in the system.
>
> My current idea is to rename the "foo" table to something that would
> stand-out like "foo_with_deleted_rows". Then we would create a view
> named "foo" that would select all the rows except the soft-deleted views.

[...]

> Is this sensible? Is there another approach to soft-deletes I should be
> considering?

yes, rename the table and replace it with a view that excludes the soft
deleted records. Make "do instead" rules to handle inserts, updates
and deletes on the view by rediecting them to the base table.

-- 
⚂⚃ 100% natural




pgsql-sql by date:

Previous
From: SEKA Bruno-Emmanuel
Date:
Subject: Re: ALTER USER abc PASSWORD - what's going on ???
Next
From: bricklen
Date:
Subject: Re: copy from csv, variable filename within a function