Postgresql sequences

Mike Rowan michael.rowan3 at gmail.com
Tue Feb 8 23:09:59 UTC 2022


I could really do with a strong hint on this one.

Omnis 10.2 on Mac
Postgresql 14.1
I have not until now used sequences preferring to roll my own $inserts in
my tables.  However, I think I now should in order to fully utilise all
the  Postgresql offers.

So, I have created new table te with two columns te_id (serial) and val
(integer)

In pgAdmin4 I can insert new rows with auto-generated te_id. So, the pg
part works fine.

In Omnis I have a test window with a list (iList) and a row (iRow) both
defined from a table class 'tte'.
In the window $construct I run Do iList.$select() and then Do
iList.$fetch(kfetchall) to populate the list. The select and fetch work
correctly, so I know the table class is constructed correctly.

In the table class I have left $insert untouched, so it uses the built-in
method.
On the window, for iRow, only iRow.val is displayed as an entry field.
te_id is not displayed.

When I attempt to save a new value (42), the values in iRow are (null,42).
An error is thrown by the table class $insert ('Statement could not be
executed.')

I don't see how to find out why this is happening, unless some kind soul
can enlighten me.  After three days trying this and that, I'd be so glad.

I have a feeling this is to do with the contents of iRow.te_id. If not
null, what should it be? A real-life example here would be very useful.

Mike


More information about the omnisdev-en mailing list