Ask Your Question

Can an autovalue primary key be created with PostgreSQL? [closed]

asked 2013-06-07 17:00:40 +0200

cootcraig gravatar image

updated 2015-09-07 20:54:08 +0200

Alex Kemp gravatar image

Using LibreOffice: Version (Build ID: 400m0(Build:3)) on Ubuntu Raring.

In LibreOffice base with an external PostgreSQL database through the native driver, when I set integer primary keys with autovalue, the autovalue was not done when the tables were created.

Is this a known problem?

Would the autovalue be done properly if I use the PostgreSQL JDBC driver?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-21 12:27:30.671266


Autovalue integer primary keys do work with PostgreSQL through the JDBC driver, postgresql-9.2-1002.jdbc4.jar Here is what I did: 1) type is integer(serial). 2) Set autovalue. The type is created as serial in PostgreSQL. I'm not sure if this can be done with the native driver, but for now I will assume that the JDBC PostgreSQL driver is the one to use.

cootcraig gravatar imagecootcraig ( 2013-06-07 17:43:13 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2014-02-23 08:11:54 +0200

Libre Nut gravatar image

I want to expand on the comment by cootcraig so that newbies like me will find it useful.

The auto-value primary key works well. If you are comfortable working with libreoffice and not with the database directly (like me) you can follow these steps:

  1. Create the new table in LO without the primary key column
  2. Create the primary key column in the database directly ( I use pgAdmin to manage the postgres database - I find it very user friendly)
  3. Make sure the data type is 'serial'.

That's it. When you reconnect your LO to the database the primary key column is available and when you design a form the auto value works too. Thanks to all the people who have helped me find this solution.

edit flag offensive delete link more

answered 2014-04-26 18:40:38 +0200

Alex Thurgood gravatar image

The native driver does not support the automagic creation of the correct DDL :

edit flag offensive delete link more

Question Tools


Asked: 2013-06-07 17:00:40 +0200

Seen: 1,073 times

Last updated: Apr 26 '14