Is there a way I can set up a column in PostgreSQL 9.2 such that the default value is a query? I am having to track down query statements from different sources that don't respect the "default" behavior that would like to be seen in the various projects that are writing to the DB.
INSERT INTO Person(name, token, priv, sc) VALUES ('Frank Josephson', '**fake token**', 'user' , (SELECT COUNT(*) FROM Person WHERE name='Frank Josephson'));
Otherwise, it's just me auditing a bunch of excel sheets and applications to make sure this new directive goes through. Any way to set this up as a trigger without running into race conditions?