Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-08 Thread Raphael Bauduin
On Thu, Nov 7, 2013 at 7:24 PM, Tom Lane wrote: > I wrote: > > It looks like the problem is we're building a MergeAppend plan and not > > getting the targetlist for the MergeAppend node right. > > Found it --- simple oversight in building optimized min/max plans. > If you need a patch now, see >

Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-07 Thread Tom Lane
I wrote: > It looks like the problem is we're building a MergeAppend plan and not > getting the targetlist for the MergeAppend node right. Found it --- simple oversight in building optimized min/max plans. If you need a patch now, see http://git.postgresql.org/gitweb/?p=postgresql.git;a=patch;h=5d

Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-07 Thread Tom Lane
Raphael Bauduin writes: > The query is also problematic here, because it returns the full json, and > not only the data I selected in the json. Doh, right, you mentioned that in the original bug report, and now that I'm paying a bit more attention I see it too. I was looking for some sort of err

Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-07 Thread Raphael Bauduin
The query is also problematic here, because it returns the full json, and not only the data I selected in the json. Below, it should return only '_id', and not the whole json stored in event: test3=> select max(event->>'_id') from events where event is not null; max -

Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-07 Thread Tom Lane
Raphael Bauduin writes: > I have narrowed it a bit. It happens when I create said index on an empty > field. Here's the scenario to reproduce it: Thanks, I've reproduced the problem here. The query still seems to run OK, it's just EXPLAIN that's falling over --- do you see the same?

Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-07 Thread Raphael Bauduin
Correction: It happens when I create said index on an empty *table*. Raph On Thu, Nov 7, 2013 at 11:10 AM, Raphael Bauduin wrote: > Hi, > > I have narrowed it a bit. It happens when I create said index on an empty > field. Here's the scenario to reproduce it: > > Let me know if you need more i

Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-07 Thread Raphael Bauduin
Hi, I have narrowed it a bit. It happens when I create said index on an empty field. Here's the scenario to reproduce it: Let me know if you need more info Cheers Raph create table events(id SERIAL, timestamp timestamp, event json); create table event

Re: [GENERAL] problem with partitioned table and indexed json field

2013-11-03 Thread Raphael Bauduin
I'll look at providing such an example later this week. Raph On Thu, Oct 31, 2013 at 3:23 PM, Tom Lane wrote: > Raphael Bauduin writes: > > An explain returns an error: > > => explain select max(event->>'_id') from events; > > ERROR: no tlist entry for key 2 > > This is certainly a bug. Can

Re: [GENERAL] problem with partitioned table and indexed json field

2013-10-31 Thread Tom Lane
Raphael Bauduin writes: > An explain returns an error: > => explain select max(event->>'_id') from events; > ERROR: no tlist entry for key 2 This is certainly a bug. Can we see a self-contained example that triggers that? regards, tom lane -- Sent via pgsql-general m

Re: [GENERAL] problem with partitioned table and indexed json field

2013-10-31 Thread Raphael Bauduin
It's postgresql 9.3, from the pgdg apt repository: 9.3.0-2.pgdg10.4+1 Raph On Thu, Oct 31, 2013 at 1:48 PM, Merlin Moncure wrote: > On Thu, Oct 31, 2013 at 5:46 AM, Raphael Bauduin > wrote: > > > > Hi, > > > > I have a partitioned table events, with one partition for each month, eg > > events

Re: [GENERAL] problem with partitioned table and indexed json field

2013-10-31 Thread Merlin Moncure
On Thu, Oct 31, 2013 at 5:46 AM, Raphael Bauduin wrote: > > Hi, > > I have a partitioned table events, with one partition for each month, eg > events_2013_03. The partition is done on the field timestamp, and > constraints are set, but insertion of data is done in the partition directly > (so not