-3

Is a primary key field NOT NULL by default in postgres, or does it need to be specified as such when creating the table?

Andrew Einhorn
  • 457
  • 5
  • 11

1 Answers1

6

Quote from the manual

Adding a primary key will automatically create a unique B-tree index on the column or group of columns listed in the primary key, and will force the column(s) to be marked NOT NULL.

(emphasis mine)

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843