Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 2BF671EAB822 for ; Wed, 7 Mar 2012 19:51:07 -0400 (AST) Received: from mailfront3.rz.tu-bs.de ([134.169.12.134] helo=tu-bs.de) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S5QdO-0005wG-72 for pgsql-jdbc@postgresql.org; Wed, 07 Mar 2012 23:51:07 +0000 Received: from [92.76.134.193] (account y0014032@tu-braunschweig.de [92.76.134.193] verified) by rz.tu-bs.de (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 11460050; Thu, 08 Mar 2012 00:50:51 +0100 Message-ID: <4F57F45B.3070807@tu-braunschweig.de> Date: Thu, 08 Mar 2012 00:50:51 +0100 From: Stefan Reiser User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Firefox/10.0.2 SeaMonkey/2.7.2 MIME-Version: 1.0 To: Anton Bobov , pgsql-jdbc@postgresql.org Subject: Re: Updatable query and column aliases References: <4F5725EE.6070503@sibsac.ru> In-Reply-To: <4F5725EE.6070503@sibsac.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201203/15 X-Sequence-Number: 22754 Anton Bobov schrieb: > Hi folks. > > I cant moveToInsertRow when use queries with assigned names in select > list. > > Following code works good: > > stmt = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, > ResultSet.CONCUR_UPDATABLE); > rs = stmt.executeQuery("select id from test"); > rs.moveToInsertRow(); > > , but then I change query to "select id val from test" exception "The > column name id was not found in this ResultSet." raised on > moveToInsertRow. > > Is it any limitation on updatable queries? > > -- > Anton > > Hello Anton, yes, the limitations are: 1) query must only use one table 2) no column aliases can be used Point 2 is a bug which I have described here: http://archives.postgresql.org/pgsql-jdbc/2010-12/msg00084.php and here: http://archives.postgresql.org/pgsql-jdbc/2011-08/msg00077.php The patch mentioned above does not work anymore since some things have changed in later versions of the driver. Here is a patch for version 9.0.801 (the only file that has to be changed is "AbstractJdbc2ResultSet"). http://home.arcor.de/stefanreiser/docs/postgresql/9.0.801/AbstractJdbc2ResultSet.java ... sorry, I'm not familiar with the versioning system - maybe one of the developers can take a look at my patch? Regards Stefan Reiser