AW: Can't INSERT

Rudolf Bargholz rudolf at bargholz.ch
Thu Jul 7 16:10:15 UTC 2022


Hi Das,

In these cases, the statement $errortext and statement $sqltext would help in finding the cause of your issue. This might be a duplicate primary key issue. If you have defined a primary key on the table, and are returning the primary key on the insert, you need to $excludefrominsert() the primary key column, otherwise the database will generally try to insert the primary key you supply in the SQL. Perhaps this is the issue you are having. But, not using Postgres in production, there might be other issues, or I might be wrong here. The errortext and sqltext will help you the most.

Regards

Rudolf Bargholz

-----Ursprüngliche Nachricht-----
Von: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> Im Auftrag von Das Goravani
Gesendet: Donnerstag, 7. Juli 2022 18:05
An: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
Betreff: Can't INSERT


I’m having trouble inserting my first record into a Postgres database. 

I’m logged on, have a session

I can’t get either of the following two insert types to work, they return flag false.

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


Do iro.$definefromsqlclass('scustomers')
Do iro.$sessionobject.$assign($ctask.tSessObjPGRef) Returns #F Do iro.$insert(' RETURNING cust_id') Returns #F


Any ideas why I might be getting flag false?

I checked the $insertnames, and found that it is working correctly. 
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 


More information about the omnisdev-en mailing list