[SQL] Peer-review requested of soft-delete scheme

2013-04-16 Thread Mark Stosberg

Hello,

I'm working on designing a soft-delete scheme for our key entity-- there
are 17 other tables that reference our key table via RI. Let's call the
table "foo".

I understand there are a couple common design patterns for soft-deletes:

1. Use a trigger to move the rows to a "tombstone table".
2. Add an "deleted flag" to the table.

The "tombstone table" approach is out for us because all the RI.

The "deleted flag" approach would be a natural fit for us. There's
already a "state" column in the table, and there will only be a small
number rows in the "soft-deleted" state at a time, as we'll hard-delete
them after a few months. The table has only about about 10,000 rows in
it anyway.

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.

I think that would make it unlikely for a developer or reviewer to mess
up SELECTs involving the statement.  Inserts/Updates/Delete statements
against the table are view, and coud reference the underlying table
directly.

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

Thanks!

Mark



-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] building psycopg2

2013-04-16 Thread Thomas Burnett
Hello,
I'm trying to put together a fully contained runtime environment and am having 
trouble with fully qualified path names to dynamic library being included in 
_psycopg2.so (I'm on a Mac).  See below:

^@^L^@^@^@`^@^@^@^X^@^@^@^B^@^@^@^@^E^E^@^@^@^E^@/Users/tburnett/Development/Lab7/main/alpha/build/BPD/lib/libpq.5.dylib^@^L^@^@^@h^@^@^@^X^@^@^@^B^@^@^@^@^@^A^@^@^@^A^@/Users/tburnett/Development/Lab7/main/alpha/build/BPD/lib/libssl.1.0.0.dylib^@^@^@^@^L^@^@^@h^@^@^@^X^@^@^@^B^@^@^@^@^@^A^@^@^@^A^@/Users/tburnett/Development/Lab7/main/alpha/build/BPD/lib/libcrypto.1.0.0.dylib^@^L^@^@^@8^@^@^@^X^@^@^@^B^@^@^@^@^C©^@^@^@^A^@/usr/lib/libSystem.B.dylib^@^@^@^

How can I remove the fully qualified paths so that I can find them through 
DYLD_LIBRARY_PATH?

Thanks.
Thomas.

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql