title: common sequence across multiple tables
body: <p>I'm trying to create a sequence owned by multiple tables, to have a unique identifier over more tables. The only workaround i can think about right know is using a nextval(blabla_id_seq) when INSERTing, but obviously it wont work when using COPY (or some other situations which i can't think of right now).<br>
  So anybody know a solution or  another workaround for this ?   Purpose of question is mostly educational.</p>
  
  <p>Cheers,
  Don</p>
  
  <p>LE And can i implement a global primary key for two (or more) table , parent and child? Currently i tried </p>
  
  <pre><code>
  
  
  DROP TABLE IF EXISTS child;
  DROP TABLE IF EXISTS parent;
  
  CREATE TABLE parent (
  id serial PRIMARY KEY
  , categ varchar(20) NOT NULL
  
  );
  
  CREATE TABLE child (
  else varchar (30) NOT NULL
  , id integer -- i have also tried with no id in child table, on;y when using   
  --"id serial" does id become primary key
  , CONSTRAINT PK__child PRIMARY KEY (id)
  
  ) INHERITS (parent);
  
  COPY parent (categ)
  FROM 'E:\\1\\_parent.csv'
  WITH CSV;
  
  COPY child(categ,altceva)
  FROM  'E:\\1\\_child.csv'
  WITH CSV;
  
  INSERT INTO child (id,categ,altceva)
  --VALUES(nextval('parent_id_seq')+3,'kid7','blabla');
  VALUES(5,'kid7','blabla');
  
  
  </code></pre>
  
  <p>but i can insert duplicates</p>