I know that you can not do an update on a serial column and if you try
you get an error, but why don't you get an error with the following syntax?
define l_a_table record like a_table.*
initialize l_a_table.* to null
update a_table set * = l_a_table.*
where a_table.link = l_a_table.link
In this example a_table.link is a serial column does the update statement
ignore the serial column when using the syntax 'set *'? I'm just
wondering if it is safe to do it this way or if I should list
all the columns except the serial in the update.
Because the I4GL compiler (which must be what is being used - the
'l_a_table.*' notation gives that away) carefully modifies the
statement and removes the serial column from the list. You could see
this if you compile the source with the '-keep' option to the c4gl
script, and then inspect the file.ec or file.c file that is left
behind.
-=JL=-
Correct so far.
> So, I would imagine if you can insert in to the row, you should be able to update the row including the serial field as long as the new value isn't already in use. IE if your table has a record with a serial value of 5, if you try to update another record using 5 in the serial field, you'd get an error.
You cannot update a SERIAL (or SERIAL8, or BIGSERIAL) column. Period.
IDS does not allow you to do so; neither does SE (which only has
SERIAL and not the other two types).
-=JL=-