Hi, I will document the limitation of the row id: "Please note the row id is not available until after the row was added (that means, it can not be used in computed columns or constraints)."
> rowid int as convert(_rowid_, int) This doesn't work. You would have to use a sequence or auto-increment column. > Since the _ROWID_ column would be changed on every row update Actually, the row id might stay if you update a row. There is no guarantee that it changes. Regards, Thomas On Fri, Aug 30, 2013 at 8:50 AM, Noel Grandin <[email protected]> wrote: > > On 2013-08-29 17:30, Laird Nelson wrote: > >> I have a column defined like this: >> >> rowid int as convert(_rowid_, int) >> >> The idea is that I am trying to effectively alias the _rowid_ column that >> H2 already adds to every table, so that I can emulate an Informix database >> (which adds "rowid" to every table). >> >> When I select rowid, the value is always 0, even after inserts. >> >> > Yeah, sorry but that isn't going to work. > > We calculate the value of the computed column BEFORE we store it, and at > that point in time the value of __rowid__ is always zero. > > You could probably create the behaviour you want a combination of views > and triggers. > http://h2database.com/html/**advanced.html#updatable_views<http://h2database.com/html/advanced.html#updatable_views> > > > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to > h2-database+unsubscribe@**googlegroups.com<h2-database%[email protected]> > . > To post to this group, send email to [email protected]. > Visit this group at > http://groups.google.com/**group/h2-database<http://groups.google.com/group/h2-database> > . > For more options, visit > https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> > . > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/groups/opt_out.
