title: How to make the Primary Key have X digits in PostgreSQL?
body: <p>I am fairly new to SQL but have been working hard to learn. I am currently stuck on an issue with setting a primary key to have 8 digits no matter what. </p>
  
  <p>I tried using <code>INT(8)</code> but that didn't work. Also <code>AUTO_INCREMENT</code> doesn't work in PostgreSQL but I saw there were a couple of data types that auto increment but I still have the issue of the keys not being long enough.</p>
  
  <p>Basically I want to have numbers represent User IDs, starting at <code>10000000</code> and moving up. <code>00000001</code> and up would work too, it doesn't matter to me.</p>
  
  <p>I saw an answer that was close to this, but it didn't apply to PostgreSQL unfortunately.</p>
  
  <p>Hopefully my question makes sense, if not I'll try to clarify.</p>
  
  <p>My code (which I am using from a website to try and make my own forum for a practice project) is:</p>
  
  <pre><code>CREATE Table users (
  user_id     INT(8) NOT NULL AUTO_INCREMENT,
  user_name   VARCHAR(30) NOT NULL,
  user_pass   VARCHAR(255) NOT NULL,
  user_email  VARCHAR(255) NOT NULL,
  user_date   DATETIME NOT NULL,
  user_level  INT(8) NOT NULL,
  UNIQUE INDEX user_name_unique (user_name),
  PRIMARY KEY (user_id)
  ) TYPE=INNODB;
  </code></pre>
  
  <p>It doesn't work in PostgreSQL (9.4 Windows x64 version). What do I do?</p>