Using currval in insert


I am using 2.0.1 on Postgresql. I am trying to use the current value of a sequence in an insert via:

        <insert tableName="role_permission">

            <column name="role_id" valueNumeric="currval('seq_role')" />

            <column name="permission_id" valueNumeric="1" />


this leads to the following sql:

INSERT INTO role_permission (permission_id, role_id) VALUES (1, currval('seq_role')

As you can see it is missing the final parenthesis. This also happens when trying to use nextval in an insert (e.g. insert into role (id, name) values (nextval('seq_role', 'accounts')).

I have worked around this by using for the foreign key insert and by setting a default value on the column for the primary key, however I thought it worth raising as an issue.


Thanks, I’ll take a look at it.