Re: partitioning / rules - strange behavior - Mailing list pgsql-general

From Tomas Vondra
Subject Re: partitioning / rules - strange behavior
Date
Msg-id 45C6D64B.6060506@fuzzy.cz
Whole thread Raw
In response to Re: partitioning / rules - strange behavior  ("Greg Sabino Mullane" <greg@turnstep.com>)
Responses Re: partitioning / rules - strange behavior
List pgsql-general
> Looks to me as though you have forgottent the table inheritance part of the
> table partitioning trick. Are you sure that sessions_900000 inherit from
> the sessions table? Does a direct count from the table referenced by the
> rule return a non-zero count? In other words:
>
> SELECT count(*) FROM sessions_900000 where id = currval('sessions_id_seq');

No, the tables are inherited, i.e. there's something like

CREATE TABLE sessions_8000000 (
  CHECK (id BETWEEN 8000000 AND 8499999
) INHERITS (sessions);

I've checked this for all the partitions (we're using three right now)
as well as the direct count (returns nothing).

As I already said - it works until I create a rule for the next
partition (not used yet) - then is suddenly stops working.

> (or some other similar table) may show your "missing" rows. The other
> possibility is that the you are not using sessions_id_seq in the way
> you think you are.

What do you mean? I do a 'SELECT currval(...)' after the insert and it
gives me the right value. It works until I create the next RULE, so this
does not seem as a sequence problem.

Tomas

pgsql-general by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: partitioning / rules - strange behavior
Next
From: Tom Lane
Date:
Subject: Re: partitioning / rules - strange behavior