Error when creating a table: conflicting NULL/NOT NULL declarations for column "id" of table
See original GitHub issueBug report
Describe the bug
When trying to create a new table (with default settings, besides the required name field) with an id
primary key, the following 400 response is returned:
{"error":{"code":400,"message":"conflicting NULL/NOT NULL declarations for column \"id\" of table \"companies\""}}
The table is still created, despite the error thrown. So I tried to just add the id column manually, but the same error is returned.
I also started a completely fresh project and tried it and the same error arose.
To Reproduce
- Create a new Supabase project
- Go to Table Editor
- Click New Table
- Enter a name in the Name field
- Leave all other settings as is
- Click Save
Expected behavior
It should create a table with no errors.
Screenshots


System information
- OS: macOS 11.4
- Browser: Brave
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:5
Top Results From Across the Web
sql - conflicting NULL/NOT NULL declarations for column ...
PSQLException : ERROR: conflicting NULL/NOT NULL declarations for column "nullid" of table "t_1". Stack: Java+Heroku+Tomcat9+PostGreSQL 9.5.
Read more >BUG #16913: GENERATED AS IDENTITY column nullability is ...
ERROR : conflicting NULL/NOT NULL declarations for column "id" of table > "foo". > Is this intended? GENERATED BY DEFAULT does create a...
Read more >PostgreSQL Not-Null Constraint
We will introduce you to the NULL concept and how to use PostgreSQL not-null constraint to make sure that the values in columns...
Read more >Name of not null constraint is missing in error message
Define two NOT NULL column constraints on the table distributors, one of which is explicitly given a name: CREATE TABLE distributors ( did ......
Read more >"conflicting NULL/NOT NULL declarations" from sqlite3 to ...
I'm running into the following error while trying to migrate the schema: ... conflicting NULL/NOT NULL declarations for column "id" of table ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If anyone else is stumbling on this while it’s still an issue, the workaround is you can just use the SQL editor to create or update your tables. Go the SQL tab, and open the Welcome tab under Getting Started. Choose the Create Table under Scripts to get a starter script (pasted below). The line you’re looking for in this case is
id bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
Just tested this myself and looks like it is fixed. Closing.