Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group