Re: Table Partitioning

From: Richard Onorato <richard_onorato(at)yahoo(dot)com>
To: Richard Onorato <richard_onorato(at)yahoo(dot)com>, Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Table Partitioning
Date: 2013-05-23 02:17:18
Message-ID: 1369275438.8792.YahooMailNeo@web141001.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

So I worked around most of my errors.  I removed the bigserial and used two of the columns as the primary key.  I am now getting the following hibernate exception back:
Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

This appears to be caused by the fact that the function is not returning back the row count.  I did a google search and found a few suggestions on how to resolve this issue, but they do not seem to work well.  I tried returning NEW, but that seems to cause the engine to also insert the record in the base table as well as a partition.  Thus I end up with 120 records when I am expecting just 60.

Any ideas on how I can fix this issue?
 
Regards,

Richard

________________________________
From: Richard Onorato <richard_onorato(at)yahoo(dot)com>
To: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, May 22, 2013 7:27 PM
Subject: Re: [GENERAL] Table Partitioning

Raghavendra,

I am doing my inserts via Java JPA statements embedded in my Data Access Layer.  I can share them if you would like to see them.
 
Regards,

Richard

________________________________
From: Raghavendra <raghavendra(dot)rao(at)enterprisedb(dot)com>
To: Richard Onorato <richard_onorato(at)yahoo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Sent: Wednesday, May 22, 2013 2:39 AM
Subject: Re: [GENERAL] Table Partitioning

On Wed, May 22, 2013 at 6:54 AM, Richard Onorato <richard_onorato(at)yahoo(dot)com> wrote:

Were you able to get it to insert with the bigserial being used on the table?  

Yes.
 
Every time I go to do an insert into one of the inherited tables I am now getting the following exception:
>org.hibernate.HibernateException: The database returned no natively generated identity value
>
>

Hmm, I guess you are inserting on the parent table not directly into inherited table.
Can you share the INSERT statement.
 
Is auto-increment supported on table partitioning?

Yes, BIGSERIAL will create a sequence that will be shared by all child partitions.
Check below example as per your test case, INSERT statement do not have BIGSERIAL column still its auto-increment and populated data in child tables. 

postgres=# insert into mymappingtable(c1,c2,c3,count,createdtime) values (9,20,30,1,now());
INSERT 0 0
postgres=# insert into mymappingtable(c1,c2,c3,count,createdtime) values (7,20,30,1,now());
INSERT 0 0
postgres=# select * from mymappingtablet5;
 id | c1 | c2 | c3 | count |           createdtime
----+----+----+----+-------+----------------------------------
  8 |  9 | 20 | 30 |     1 | 2013-05-18 02:08:33.061548+05:30 

postgres=# select * from mymappingtablet3;
 id | c1 | c2 | c3 | count |           createdtime
----+----+----+----+-------+----------------------------------
  9 |  7 | 20 | 30 |     1 | 2013-05-18 02:12:03.076529+05:30
(1 row)

(Request not to top-post please ... :)  )

---
Regards,
Raghavendra
EnterpriseDB Corporation
Blog: http://raghavt.blogspot.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sajeev Mayandi 2013-05-23 05:34:46 Rule for all the tables in a schema
Previous Message Dev Kumkar 2013-05-23 01:06:05 Re: [ODBC] ODBC constructs