Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UN24c-0000SV-83 for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Apr 2013 14:20:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UN24b-0004OH-Je for pgsql-bugs@arkaria.postgresql.org; Tue, 02 Apr 2013 14:20:29 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UMvNX-0000vf-MB for pgsql-bugs@postgresql.org; Tue, 02 Apr 2013 07:11:35 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UMvNV-0003MX-4V for pgsql-bugs@postgresql.org; Tue, 02 Apr 2013 07:11:35 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UMvNU-0002rn-M4 for pgsql-bugs@postgresql.org; Tue, 02 Apr 2013 07:11:33 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1UMvNP-0002z1-Fr for pgsql-bugs@postgresql.org; Tue, 02 Apr 2013 07:11:27 +0000 Date: Tue, 02 Apr 2013 07:11:27 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #8027: Get generated key value while inserting in partitioned table To: pgsql-bugs@postgresql.org From: mohansammeta@gmail.com X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 8027 Logged by: mohan sammeta Email address: mohansammeta@gmail.com PostgreSQL version: 8.4.0 Operating system: ubuntu Description:=20=20=20=20=20=20=20=20 Hi I have a table in Postgres, say email_messages. It is partitioned so whatever the inserts i do it using my java application will not effect the master table, as the data is actually getting inserted in the child tables. Here is the problem, I want to get an auto generated column value (say email_message_id which is of big serial type). Postgres is returning it as null since there is no insert being done on master table. For oracle I used GeneratedKeyHolder to get that value. But I'm unable to do the same for partitioned table in postgres. Please help me out. Here is the code snippet we used for oracle public void createAndFetchPKImpl(final Entity pEntity, final String pStatementId, final String pPKColumnName) { final SqlParameterSource parameterSource =3D new BeanPropertySqlParameterSource(pEntity); final String[] columnNames =3D new String[]{"email_message_id"}; final KeyHolder keyHolder =3D new GeneratedKeyHolder(); final int numberOfRowsEffected =3D mNamedParameterJdbcTemplate.update( getStatement(pStatementId), parameterSource, keyHolder, columnNames); pEntity.setId(ConversionUtil.getLongValue(keyHolder.getKey())); } We are using spring 3.1.1. I am getting numberOfRowsEffected as zero and keyHolder.getKey() as null even though the insert is happening in the table. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs