From: | Malm Paul <paul(dot)malm(at)saabgroup(dot)com> |
---|---|
To: | Malm Paul <paul(dot)malm(at)saabgroup(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: metadata on a table |
Date: | 2010-05-19 07:46:10 |
Message-ID: | 2CF53313EAE78542876F7C9689F9F72504553217@corpappl747.corp.saab.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ahhh.
boolean isAutoIncerment = rsMetaData.isAutoIncrement(1);
if int4 and autoIncremented = serial
Sorry!!
________________________________
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Malm Paul
Sent: den 19 maj 2010 08:44
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] metadata on a table
Hi,
I'm trying to read the metadata from table to create the same sort of table in another database, using java.
This is how I do it today
quwstion = "SELECT * FROM table"
stmnt = dbConnection.prepareStatement(question);
rs = stmnt.executeQuery();
ResultSetMetaData rsMetaData = rs.getMetaData();
int numberOfColumns = rsMetaData.getColumnCount();
System.out.println("resultSet MetaData column Count=" + numberOfColumns);
int precision = rsMetaData.getPrecision(1);
String columnTypeName = rsMetaData.getColumnTypeName(1);
String name = rsMetaData.getColumnName(1);
String classname = rsMetaData.getColumnClassName(1);
The first object is the primary key with the name "fid",
columnTypeName = int4
I can see in the original table that fid has the type serial, which is an int4 (pgAdmin).
But when I create the table in the other database I would like to create it as serial not just int4, how can I know that it is a serial?
Kind regards,
Paul
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2010-05-19 08:15:01 | Re: default ordering of query result - are they always guarantee |
Previous Message | A. Kretschmer | 2010-05-19 07:38:35 | Re: default ordering of query result - are they always guarantee |