title: Generating a random 10-digit ID number in PostgreSQL
body: <p>I apologize if this has been answered elsewhere. I found similar posts but nothing that exactly matches what I was looking for. I am wondering if it is possible to randomly assign a number as data is entered into a table. For example, for this table</p>
  <pre><code>CREATE TABLE test (
  id_number INTEGER NOT NULL,
  second_number INTEGER NOT NULL)
  </code></pre>
  <p>I would like to be able to do the following:</p>
  <pre><code>INSERT INTO test (second_number)
  VALUES (1234567)
  </code></pre>
  <p>where id_number is then populated with a random 10-digit number. I guess I want this similar to SERIAL in the way it populates but it needs to be 10 digits and random. Thanks very much</p>