Thread: How to find if a column is a "serial" column?

How to find if a column is a "serial" column?

From
Dave Bartmess
Date:
I'm trying to write an insert routine, but I want to have the serial
column(s) excluded from the update/insert SQL commands, which I'm
building on the fly.

How do I determine if a column has been declared as a serial, since it
only comes back in getColumns() as java.sql.Types.INTEGER in the
resultset column "DATA_TYPE"?

Thanks!
--
David A. Bartmess
Software Configuration Manager / Sr. Software Developer
eDingo Enterprises
http://edingo.net


Re: How to find if a column is a "serial" column?

From
Kris Jurka
Date:

On Sat, 20 Dec 2003, Dave Bartmess wrote:

> How do I determine if a column has been declared as a serial, since it
> only comes back in getColumns() as java.sql.Types.INTEGER in the
> resultset column "DATA_TYPE"?

Well, there is no value in java.sql.Types which represents the serial
data type.  We could possibly return "serial" as the TYPE_NAME column
instead of int, but this could cause problems for other people who expect
it to return int.  I would suggest examining COLUMN_DEF to see if it is
calling a sequence.  This is kind of hack, but so is the serial type.

Kris Jurka


postgres 7.4.1 release

From
Dave Cramer
Date:
New drivers have been uploaded to the jdbc.postgresql.org/download

thanks to Kris for building them

Dave