Serial data type

From: "Christian Rengstl" <Christian(dot)Rengstl(at)klinik(dot)uni-regensburg(dot)de>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Serial data type
Date: 2007-11-30 10:52:39
Message-ID: 474FF9E7.90AD.0080.0@klinik.uni-regensburg.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi everyone,

in my Java app at certain points INSERT queries are built dynamically,
but now i am facing a problem when the target table contains a SERIAL
field where NULL values are not allowed. Therefore I have two questions:

1) How can I find out if there is a serial field in a table, as
getColumnType() in ResultSetMetaData does not return a field indicating
SERIAL as far as I could see?
2) Why does it not work to issue a query like INSERT INTO
x(serial_field) VALUES(NULL) as the default of the "serial_field" is
nextval() anyway?

Thanks!

Christian Rengstl M.A.
Klinik und Poliklinik für Innere Medizin II
Kardiologie - Forschung
Universitätsklinikum Regensburg
B3 1.388
Franz-Josef-Strauss-Allee 11
93053 Regensburg
Tel.: +49-941-944-7230

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-11-30 11:01:30 Re: Serial data type
Previous Message tivvpgsqljdbc 2007-11-29 10:18:48 Re: PreparedStatement vs. Statement problem