Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctHCX-0001ur-01 for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Mar 2017 17:16:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ctHCW-0007S0-Gn for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Mar 2017 17:16:04 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ctHB0-0004k4-F8 for pgsql-hackers@postgresql.org; Wed, 29 Mar 2017 17:14:30 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ctHAw-0006ZN-TB for pgsql-hackers@postgresql.org; Wed, 29 Mar 2017 17:14:29 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 8851221C2193; Wed, 29 Mar 2017 20:14:25 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru Subject: Re: [PATCH] Generic type subscripting DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1490807665; bh=lh3YXHdzLL8L3N10mRdsB42orQ57KzwciJ19VuAmTx0=; h=To:References:Cc:From:Date:In-Reply-To; b=Z2lnWD95B9Z4KvV5WScq4TKP2ZJKxLqYKvu9kJosYzlKJPUEHr0NzuGuWLCaweA2m mJqFifroBS93UwzFL+lncJjo0RrOmvvBhDpDA3hNe1HYTatepZX0SH/ZbhW9Q/Wtl+ 4IkjXAZ7tyQ6oK3cY1y/51nYjDmazCgYTKZ3IuAQ= To: Dmitry Dolgov <9erthalion6@gmail.com> References: <20423.1489533013@sss.pgh.pa.us> <393cd0ae-5b84-849e-fc73-7077470a009e@pgmasters.net> <65df4a65-a9d8-3531-5baf-edb237771f0e@pgmasters.net> <22355.1490369372@sss.pgh.pa.us> <449f42b9-f338-9e45-cb33-3e15c7b547ad@postgrespro.ru> Cc: Tom Lane , David Steele , peter.eisentraut@2ndquadrant.com, PostgreSQL-development From: Arthur Zakirov Message-ID: <38e32275-91f2-61e9-24dd-57135a662c41@postgrespro.ru> Date: Wed, 29 Mar 2017 20:14:27 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 28.03.2017 19:31, Dmitry Dolgov wrote: > On 28 March 2017 at 12:08, Dmitry Dolgov <9erthalion6@gmail.com > > wrote: >> >> Wow, I didn't notice that, sorry - will fix it shortly. > > So, here is the corrected version of the patch. I have some picky comments. I'm not sure that "typsbsparse" is better than "typsubscripting" or "typsubparse". Maybe "typsubsparse"? > > + typsubscripting > + regproc Here you didn't fix "typsubscripting" to new name. > + JSON subscripting > + > + JSONB data type support array-style subscripting expressions to extract or update particular element. An example of subscripting syntax: Should be "JSONB data type supports". > + to handle subscripting expressions. It should contains logic for verification > + and decide which function must be used for evaluation of this expression. > + For instance: Should be "It should contain". > + > + JSON subscripting > + > + JSONB data type support array-style subscripting expressions to extract or update particular element. An example of subscripting syntax: You have implemented jsonb subscripting. The documentation should be fixed to: + + <type>jsonb</> Subscripting + + jsonb data type support array-style subscripting expressions to extract or update particular element. An example of subscripting syntax: I think IsOneOf() macros should be removed. Since it is not used anywhere. > + Assert(subexpr != NULL); > + > + if (subexpr == NULL) > + ereport(ERROR, > + (errcode(ERRCODE_DATATYPE_MISMATCH), > + errmsg("jsonb subscript does not support slices"), > + parser_errposition(pstate, exprLocation( > + ((Node *) lfirst(sbsref->refupperindexpr->head)))))); Here one of the conditions is excess. Better to delete assert condition I think. I've tried tests from message [1]. They looks good. Performance looks similar for subscripting without patch and with patch. I wanted to implement subscripting for ltree or hstore extensions. Subscripting for ltree looks more interesting. Especially with slicing. But I haven't done it yet. I hope that I will implement it tomorrow. 1. https://www.postgresql.org/message-id/CAKNkYnz_WWkzzxyFx934N%3DEp47CAFju-Rk-sGeZo0ui8QdrGmw%40mail.gmail.com -- Arthur Zakirov Postgres Professional: http://www.postgrespro.com Russian Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers