Re: Peer-review requested of soft-delete scheme

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Peer-review requested of soft-delete scheme
Date: 2013-04-18 11:44:41
Message-ID: kkomb9$skn$2@gonzo.reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2013-04-16, Mark Stosberg <mark(at)summersault(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message bricklen 2013-04-18 13:48:31 Re: copy from csv, variable filename within a function
Previous Message SEKA Bruno-Emmanuel 2013-04-18 11:31:01 Re: ALTER USER abc PASSWORD - what's going on ???