Problem Inserting Postgres

Das Goravani goravanis at
Sat Jul 9 17:07:01 UTC 2022

Dear List,

I am on my first postgres INSERT in a new app and new database table.
I am using Postgres
I created the table by drag drop schema onto session
This is my INSERT line:

 Do tStatObjPGRef.$execdirect(con('INSERT INTO dtcustomers ',$ctask.tSessObjPGRef.$insertnames(iro),' RETURNING  cust_id')) Returns #F

This is what it says in Native Error Text:

ERROR:  null value in column "cust_id" of relation "dtcustomers" violates not-null constraint
DETAIL:  Failing row contains (null, null, null, null, null, null, null, null, null, null, null, D, null).

The problem with that error is that cust_id is the primary key and I have excluded it from insert just prior and I check SQLText and indeed it is NOT in the list of fields to INSERT nor in the values of course but I am RETURNING cust_id… 

I am hoping Postgres will auto increment it.

When you drag drop schema onto session and it is Postgres, the PK column is automatically marked as a SERIAL column.

By excluding cust_id from the list of fields to insert, I thought it did the default action for the excluded column which is nextval correct?

So I thought I was doing all the right things. 

This is my SQL and it appears correct to me but it doesn’t jive with the error being given above which seems to be saying I AM TRYING TO PASS the cust_id field in my SQL but I’m NOT

Any ideas?

More information about the omnisdev-en mailing list