[Solved] Auto-Increment on PrimaryKey with Postgresql

dBase, Calc, CSV, MS ACCESS, MySQL, PostgrSQL, OTHER

[Solved] Auto-Increment on PrimaryKey with Postgresql

Postby automas » Mon Apr 04, 2011 10:44 pm

I have created a form in OpenOffice.org.Base 3.1.0 in connection with a table in a Postgresql-Database.
This table includes a column named "id" which is the Primary Key (Data type "numeric"). The default value is "nextval('id_seq'::regclass)". "id_seq" is a Sequenze.
Now it's possible to add a new value with auto-increment using the postgresql Admin-Tool.
But if I wan't to add a new value using my form in Base the system shows an alert describing, that there's a failure with the ResultSet and I have to call "next".
Whats wrong?
Last edited by Hagar Delest on Wed Aug 10, 2011 11:28 am, edited 1 time in total.
Reason: tagged [Solved].
OpenOffice 3.1.0
Windows XP
automas
 
Posts: 2
Joined: Mon Apr 04, 2011 10:14 pm

Re: Auto-Increment on PrimaryKey with Postgresql

Postby automas » Wed Aug 10, 2011 11:06 am

In the meantime I solved the problem.
Obviously the Data type of the Primary Key should be "serial" or "bigserial". If you do so the value of "Default value" is automatically written (For example: "nextval('"Table1_id_seq"'::regclass)").
OpenOffice 3.1.0
Windows XP
automas
 
Posts: 2
Joined: Mon Apr 04, 2011 10:14 pm


Return to External Data Sources

Who is online

Users browsing this forum: No registered users and 1 guest