Postgresql sequence nextval increased by (1 + number of rows) instead of 1

eramart's profile image eramart posted 4 years ago in General Permalink

When adding a row using table grid (Insert row), sequence nextval is increased by (1 + number of rows) instead of 1. Seen from HeidiSQL 10 onward (in HeidiSQL 9.5 value increased by 1). Possibly looped nextval call after adding row (checking/drawing, etc)?

ansgar's profile image ansgar posted 4 years ago Permalink

HeidiSQL does not fire nextval() anywhere, I am even unsure if that's an API method or SQL code. I guess that has more to do with the detection of default values of an auto-incremented integer column. The table designer displays that in a broken way currently.

eramart's profile image eramart posted 4 years ago Permalink

I believe that the issue #279 is about this behaviour

mavar's profile image mavar posted 3 years ago Permalink

Unfortunatelly the problem hasn't been solved yet (version 11.2.0.6219). After inserting new row (where using sequence as a default column value is set) Heidi does the following:

INSERT INTO "table" ("class") VALUES ('21200');

SELECT "id", "class" FROM "table" WHERE "id"=nextval('sq_id'::regclass);

ansgar's profile image ansgar posted 3 years ago Permalink

I need some help for fixing that wrong query. If you have suggestions, please comment in issue #279.

Please login to leave a reply, or register at first.