title: Postgresql Partition by column without a primary key
body: <p>I'd like to be able to partition a table by <code>worksite_uuid</code>. But <code>worksite_uuid</code> needs to be nullable and I need <code>uuid</code> to be a primary key.</p>
  <p>The only way I've been able create the partition is if <code>worksite_uuid</code> is not nullable like so:</p>
  <pre><code>CREATE TABLE test (
     uuid uuid DEFAULT uuid_generate_v1mc(),
     worksite_uuid text,
     notes text
  )
  PARTITION BY LIST(worksite_uuid)
  
  //then add worksite_uuid and uuid as a primary key
  
  create table test_worksite1 partition of test for values in ('1');
  create table test_worksite2 partition of test for values in ('2');
  </code></pre>
  <p>Does anyone know how I can create a partition with only <code>uuid</code> as the primary key and make <code>worksite_uuid</code> nullable?</p>
  <p>--</p>
  <p>Example: I can't do this</p>
  <pre><code>CREATE TABLE test (
     uuid uuid DEFAULT uuid_generate_v1mc() PRIMARY KEY,
     worksite_uuid text,
     notes text
  )
  PARTITION BY LIST(worksite_uuid)
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>Query 1 ERROR: ERROR:  unique constraint on partitioned table must include all partitioning columns
  DETAIL:  PRIMARY KEY constraint on table &quot;test&quot; lacks column &quot;worksite_uuid&quot; which is part of the partition key.</p>
  </blockquote>