Hi Ross,

> Using tcpdump to compare the SQL commands sent from OOo to PostgreSQL, I 
> can see where the problem is occuring. When adding a new record via the 
> form, the INSERT includes the autosequencing column (sampleid), which 
> inserts a value of 0 (zero). When adding a new record via the OOo data 
> explorer, the sql INSERT command doesn't include the autosequencing 
> sampleid column.

Interesting. Both views share nearly the same code, so there really
shouldn't be a difference. Out of interest, if you have a form with a
table control only, does it also show the problem?

Also, in the form which has the problem, does the field bound to the
autosequencing column show a "<autovalue>" (or so) text when you enter a
new record? I somehow suspect the form doesn't recognize the respective
column is an auto-column, and the missing "<autovalue>" text would be an
indicator for this.

> In both cases, they perform a SELECT MAX(sampleid) 
> followed by a SELECT * where sampleid equals the value returned by the 
> earlier select max. For the form, this obviously selects the wrong record.

"SELECT MAX(columnid)" is only a workaround, which of course isn't
multi-user-safe at all. This workaround is used for databases where no
other way to retrieve generated values is known - unfortunately there's
no (wide-spread enough) standard to retrieve the server-side generated
values after an insertion.

I'm not sure at the moment, but I suspect PostgreSQL allows to retrieve
those values. Did you play with "Edit|Database|Advanced settings"? This
is for overriding the SELECT MAX behaviour.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer         [EMAIL PROTECTED] -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Database                   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to