0

I'm new to PostgreSQL and that is why I'm asking this question. I have a table app_client_users and a column named client_id. Initially I set it as NOT NULL and now I would like to change it to allow NULL. I've tried

alter table app_client_users alter column client_id int  NULL ;

and

alter table app_client_users alter column client_id   NULL ;

which is not working. How can I fix it?

  • 1
    Please be aware that psql is a client to PostgreSQL, not a nickname of the latter. – dezso Jan 3 '17 at 11:30
6

You can simply drop NOT NULL

ALTER TABLE app_client_users ALTER COLUMN client_id DROP NOT NULL;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.