title: Postgres PL/Python Initializing record functions
body: <p>Is there a way to pass into a PL function that is called to give a default value and how do I work with it, the rest of the inserted values?</p>
  
  <pre><code>CREATE TABLE tokensStore (
      id SERIAL PRIMARY KEY,
      users INTEGER REFERENCES users(id),
      genDate timestamp with time zone NOT NULL DEFAULT now(),
      expDate timestamp with time zone NOT NULL DEFAULT now() + interval '24 hours', 
      token char(30) NOT NULL DEFAULT tokenGenerator(%%%INSERTED VALUES%%%)   
  );
  </code></pre>
  
  <p>and also I'm not sure this is a proper way to do this, I don't know if I should allow the NULL value and make a trigger that generates the value for the token. </p>
  
  <p>The thing is that I don't want to allow null values in that column. 
  And I also want to make Inserts with returning value token something like </p>
  
  <pre><code>INSERT tokensStore(user) VALUES (1) RETURNING token; 
  </code></pre>
  
  <p>If anyone has good references on this It would be Highly appreciated. </p>