[resolved] insert into postgres table only some columns

One Star

[resolved] insert into postgres table only some columns

fails with "null value in column "column_name" violates not-null constraint"
Hello,
I want to insert two values in a postgre table with more than two columns.
The primary key has a sequence. So will be filled automaticly.
If I try. I get the error message above.
What ist the correct approach for this task?
Thank you for your help!
Christian

Accepted Solutions
Community Manager

Re: [resolved] insert into postgres table only some columns

Hello
Is there one column called "column_name" and it is defined not null in your table?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] insert into postgres table only some columns

Hello
Is there one column called "column_name" and it is defined not null in your table?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] insert into postgres table only some columns

Hello Shong,
you brought me on the right path. Thank you very much!
It was not an error of my job. It was an error of my Postgres DB.
The column name "column_name" was so strange that I was not sensitiv enough.
ALTER TABLE <table_name> ALTER COLUMN column_name DROP NOT NULL;
ALTER SEQUENCE <sequence_name> restart with 251;
Best regards,
Christian