mateusmaso
mateusmaso

Reputation: 8453

How to change a PG column to NULLABLE TRUE?

How can I accomplish this using Postgres? I've tried the code below but it doesn't work:

ALTER TABLE mytable ALTER COLUMN mycolumn BIGINT NULL; 

Upvotes: 484

Views: 276010

Answers (1)

mu is too short
mu is too short

Reputation: 434575

From the fine manual:

ALTER TABLE mytable ALTER COLUMN mycolumn DROP NOT NULL;

There's no need to specify the type when you're just changing the nullability.

Upvotes: 935

Related Questions