Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YwsZm-0004Tn-CC for pgsql-jdbc@arkaria.postgresql.org; Mon, 25 May 2015 13:37:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YwsZl-00005m-Ih for pgsql-jdbc@arkaria.postgresql.org; Mon, 25 May 2015 13:37:53 +0000 Received: from makus.postgresql.org ([174.143.35.229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YwsZk-00005c-Is for pgsql-jdbc@postgresql.org; Mon, 25 May 2015 13:37:52 +0000 Received: from rad0.itstriangle.com ([199.38.107.90]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1YwsZb-0005as-Ox for pgsql-jdbc@postgresql.org; Mon, 25 May 2015 13:37:50 +0000 Received: from itstriangle.com (localhost [127.0.0.1]) by rad0.itstriangle.com (8.14.4/8.14.4) with ESMTP id t4PDbcme009743; Mon, 25 May 2015 09:37:38 -0400 Received: FROM [192.168.157.52] ([216.220.4.222]) BY itstriangle.com WITH ESMTP ; Mon, 25 May 2015 09:37:37 -0400 Message-ID: <55632843.8060109@ttc-cmc.net> Date: Mon, 25 May 2015 07:48:51 -0600 From: dmp User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Firefox/24.0 SeaMonkey/2.21 MIME-Version: 1.0 To: Mansour Al Akeel , PostgreSQL JDBC Subject: Re: Reading schema information References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org Mansour Al Akeel wrote: > Sorry for missing the email subject in my previous email ! > > I am trying to get some information about a coloum using the method: > > DatabaseMetaData.getString("IS_GENERATEDCOLUMN") > > However it is throwing an exception: > > org.postgresql.util.PSQLException: The column name IS_GENERATEDCOLUMN > was not found in this ResultSet. > > Based on javadoc for getColumns method: > > http://docs.oracle.com/javase/7/docs/api/java/sql/DatabaseMetaData.html#getColumns(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String) > > > We have: > > IS_GENERATEDCOLUMN String => Indicates whether this is a generated column > > YES --- if this a generated column > NO --- if this not a generated column > empty string --- if it cannot be determined whether this is a generated column > > > My questions is, is this a bug ? if not, how can I obtain this > information about a column (if it's generated or not) ? > > > Thank you. > Hello, Try the following attached code, may have some syntax errors. A complete example of collecting database and table meta data my be obtained from my project on GoogleCode. danap. http://code.google.com/p/myjsqlview/ http://code.google.com/p/myjsqlview/source/browse/trunk/myjsqlview/src/com/dandymadeproductions/myjsqlview/datasource/DatabaseProperties.java http://code.google.com/p/myjsqlview/source/browse/trunk/myjsqlview/src/com/dandymadeproductions/myjsqlview/gui/panels/TableTabPanel_PostgreSQL.java ************************ Statement sqlStatement = dbConnection.createStatement(); String sqlStatementString = "SELECT * FROM " + "myTable" + " LIMIT 1"; ResultSet db_resultSet = sqlStatement.executeQuery(sqlStatementString); DatabaseMetaData dbMetaData = dbConnection.getMetaData(); ResultSetMetaData tableMetaData = db_resultSet.getMetaData(); ResultSet rs1 = dbMetaData.getColumns("myDatabase", tableMetaData.getCatalogName(1), tableMetaData.getSchemaName(1), tableMetaData.getTableName(1)); String isGenerated = rs1.getString("IS_GENERATEDCOLUMN"); -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc