Re: [GENERAL] json_populate_recordset and nested object, how to solve?

2014-04-16 Thread Raphael Bauduin
roducts') rs;-- error: ERROR: cannot call json_populate_recordset on a nested object and the simple solution I was looking for: SELECT (p->>'id')::int AS id, p->>'name' AS name FROM (SELECT json_array_elements(event->'products') AS p FROM t) t

[GENERAL] json_populate_recordset and nested object, how to solve?

2014-04-04 Thread Raphael Bauduin
Hi, here is an example of a problem I encounter with json_populate_recordset because it does not support nested object. Actually, I would prefer that it ignores nested object rather than raise an error, as it fails on a key I don't even want to use! Here's the query: select e.timestamp::date, e.

[GENERAL] need of a lateral join with record set returning function?

2014-02-03 Thread Raphael Bauduin
Hi, I'm trying to understand what happens here: I have atype product defined: =# \d product Composite type "public.product" Column | Type | Modifiers -+--+--- price_advantage | double precision | type| integer

Re: [GENERAL] returning json object with subset of keys

2014-01-08 Thread Raphael Bauduin
On Wed, Jan 8, 2014 at 4:05 PM, Merlin Moncure wrote: > On Wed, Jan 8, 2014 at 6:37 AM, Raphael Bauduin wrote: > > Hi > > > > I'm using the json functionalities of postgresql 9.3. > > I have a query calling json_populate_recordset like this: > > json_p

[GENERAL] returning json object with subset of keys

2014-01-08 Thread Raphael Bauduin
Hi I'm using the json functionalities of postgresql 9.3. I have a query calling json_populate_recordset like this: json_populate_recordset(null::product, event->'products') but it returns an error: ERROR: cannot call json_populate_recordset on a nested object There is indeed one key in event->

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 Raphael Bauduin
ll; max {"_id":"5f93c3a044650105b5074c9a","type":"t2"} Thanks raph On Thu, Nov 7, 2013 at 4:32 PM, Tom Lane wrote: > Raphael Bauduin writes: > > I have narrowed it a bit. It

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 m

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

2013-11-07 Thread Raphael Bauduin
dex create index events_2012_03_event_id_index on events_2012_03 ((event->>'_id')); explain select max(event->>'_id') from events where event is not null; --BANG drop index events_2012_03_event_id_index; explain select max(event->>'_id') from events wh

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 tlis

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, wi

[GENERAL] problem with partitioned table and indexed json field

2013-10-31 Thread Raphael Bauduin
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 with a trigger on the events table) The field event is of type json, a

Re: [GENERAL] passing multiple records to json_populate_recordset

2013-09-23 Thread Raphael Bauduin
On Mon, Sep 23, 2013 at 11:31 AM, Raphael Bauduin wrote: > Hi, > > I'm experimenting with the json data type and functions in 9.3. > I'm storing json objects of this form in the event column: > {type: 'event_type, products : [ {id:45, 'type': 3, '

[GENERAL] passing multiple records to json_populate_recordset

2013-09-23 Thread Raphael Bauduin
Hi, I'm experimenting with the json data type and functions in 9.3. I'm storing json objects of this form in the event column: {type: 'event_type, products : [ {id:45, 'type': 3, 'gender':'F',..}, ..., {} ] } I can issue this query, but notice the limit 1: select * from json_populate_records

[GENERAL] easy entry forms on a pg database

2009-05-15 Thread Raphael Bauduin
Hi, Are there any tool/libs to easily and rapidly generate web-based entry forms for tables in a postgresql database? Thanks Raphaƫl PS: In my search I've found PHP DB Form creator (http://sourceforge.net/projects/phpdbform/) but last realease is 5 years old. I also know of ERW, which doesn't s

Re: [GENERAL] ilike and utf-8

2006-04-14 Thread Raphael Bauduin
On 4/14/06, Tom Lane <[EMAIL PROTECTED]> wrote: > "Raphael Bauduin" <[EMAIL PROTECTED]> writes: > > Does the ilike operator work fine with cyrillic text put in a UTF-8 > > encoded database? > > If you've initdb'd in an appropriate locale (proba

Re: [GENERAL] ilike and utf-8

2006-04-14 Thread Raphael Bauduin
It's a Debian GNU/Linux, with a self-compiled 8.1.3 postgresql. Raph On 4/14/06, Martijn van Oosterhout wrote: > On Fri, Apr 14, 2006 at 03:16:01PM +0200, Raphael Bauduin wrote: > > Hi, > > > > Does the ilike operator work fine with cyrillic text put in a UTF-8 >

[GENERAL] ilike and utf-8

2006-04-14 Thread Raphael Bauduin
Hi, Does the ilike operator work fine with cyrillic text put in a UTF-8 encoded database? I've had remarks of a user (of http://myowndb.com, a web database) with text in cyrillic that his searches are not case insensitive, although I use the ilke operator in the code. And it works perfectly for my

Re: [GENERAL] history tables with only one function?

2004-08-12 Thread Raphael Bauduin
Andreas Haumer wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi! Raphael Bauduin wrote: Raphael Bauduin wrote: Hi, I'm looking at the logging of a database we'll put in production soon. I've seen some posts on this list about history tables, like mentioned in http://

[GENERAL] history tables with only one function?

2004-08-10 Thread Raphael Bauduin
Hi, I'm looking at the logging of a database we'll put in production soon. I've seen some posts on this list about history tables, like mentioned in http://www-106.ibm.com/developerworks/web/library/wa-dbdsgn2.html . I think I'll go that way too, but I still have some questions on the approach, an