Re: Error-safe user functions

2022-10-03 Thread Nikita Glukhov
Sorry, I didn't not tried building using meson. One line was fixed in the new test module's meson.build. -- Nikita Glukhov Postgres Professional:http://www.postgrespro.com The Russian Postgres Company errorsafe_functions_v01.tgz Description: application/compressed-tar

Error-safe user functions

2022-10-03 Thread Nikita Glukhov
l.org/message-id/flat/13351.1661965592%40sss.pgh.pa.us#3d23aa20c808d0267ac1f7ef2825f0dd [3]https://www.postgresql.org/message-id/raw/379e5365-9670-e0de-ee08-57ba61cbc976%40postgrespro.ru [4]https://www.postgresql.org/message-id/raw/0574201c-bd35-01af-1557-8936f99ce5aa%40postgrespro.ru -- Ni

Re: SQL/JSON features for v15

2022-09-01 Thread Nikita Glukhov
On 31.08.2022 23:39, Nikita Glukhov wrote: And here is a quick POC patch with an example for COPY and float4 I decided to go further and use new API in SQL/JSON functions (even if it does not make real sense now). I have added function for checking expressions trees, special executor steps

Re: SQL/JSON features for v15

2022-08-31 Thread Nikita Glukhov
with `bool *have_error` and less magical `if (have_error) ... else ereport(...)`. Obviously, this needs a separate thread. -- Nikita Glukhov Postgres Professional:http://www.postgrespro.com The Russian Postgres Company From 537e65e1ebcccdf4a760d3aa743c88611e7c Mon Sep 17 00:00:00 2001 From: Ni

Re: SQL/JSON features for v15

2022-08-23 Thread Nikita Glukhov
ssions in one case and deny in other. And there is another problem: expressions can be only checked for Const-ness only after expression simplification. AFAIU, at the parsing stage they look like 'string'::type. So, it's unclear if it is correct to check expressions in ExecInitExpr().

Re: SQL/JSON features for v15

2022-08-23 Thread Nikita Glukhov
n[b]_populate_record[set](): SELECT JSON_QUERY(jsonb '[1, "2", null]', '$' RETURNING int[]); json_query {1,2,NULL} (1 row) -- Nikita Glukhov Postgres Professional:http://www.postgrespro.com The Russian Postgres Company

Re: SQL/JSON features for v15

2022-08-23 Thread Nikita Glukhov
On 23.08.2022 19:06, Pavel Stehule wrote: Hi út 23. 8. 2022 v 17:55 odesílatel Andres Freund napsal: Hi, On 2022-08-23 10:51:04 -0400, Robert Haas wrote: > I do not think that using subtransactions as part of the expression > evaluation process is a sound idea pretty much u

Re: JSON path decimal literal syntax

2022-03-05 Thread Nikita Glukhov
t;a" (1 row) =# select '(1).a'::jsonpath::text::jsonpath; ERROR: syntax error, unexpected STRING_P, expecting $end at or near """ of jsonpath input I have added in v3 enclosing of numbers in parentheses if they have successive path items. (Changed results of several t

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-04 Thread Nikita Glukhov
On 04.03.2022 23:28, Tom Lane wrote: Tomas Vondra writes: On 3/4/22 20:29, Nikita Glukhov wrote: So, we probably have corrupted indexes that were updated since such "incomplete" upgrade of ltree. IIRC pg_upgrade is not expected to upgrade extensions - it keeps the installed vers

Re: ltree_gist indexes broken after pg_upgrade from 12 to 13

2022-03-04 Thread Nikita Glukhov
dexes that were updated since such "incomplete" upgrade of ltree. Also I found that contrib/pg_trgm/trgm_gist.c uses wrongly named macro LTREE_GET_ASIGLEN(). -- Nikita Glukhov Postgres Professional:http://www.postgrespro.com The Russian Postgres Company

Re: SQL/JSON: JSON_TABLE

2021-03-30 Thread Nikita Glukhov
On 30.03.2021 19:56, Erik Rijkers wrote: On 2021.03.27. 02:12 Nikita Glukhov wrote: Attached 47th version of the patches. Hi, Apply, build all fine. It also works quite well, and according to specification, as far as I can tell. But today I ran into: ERROR: function ExecEvalJson not in

Fix inconsistency in jsonpath .datetime()

2020-09-19 Thread Nikita Glukhov
s in built-in format strings used for datetime type recognition. (It seemed to work as expected with extra space in earlier version of the patch in which standard mode has not yet been introduced). -- Nikita Glukhov Postgres Professional:http://www.postgrespro.com The Russian Postgres Company >

Re: pgsql: Show opclass and opfamily related information in psql

2020-05-14 Thread Nikita Glukhov
On 14.05.2020 12:52, Alexander Korotkov wrote: Nikita, what do you think? I agree that this patch is an improvement. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

matchingsel() and NULL-returning operators

2020-04-17 Thread Nikita Glukhov
turned QUERY PLAN Seq Scan on test (cost=0.00..17.50 rows=1000 width=5) Filter: (NOT (js @@ '($ == 1)'::jsonpath)) (2 rows) -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: Ltree syntax improvement

2020-04-03 Thread Nikita Glukhov
On 02.04.2020 19:16, Tom Lane wrote: Nikita Glukhov writes: Rebased patch attached. Thanks for rebasing! The cfbot's not very happy though: 4842ltxtquery_io.c: In function ‘makepol’: 4843ltxtquery_io.c:188:13: error: ‘escaped’ may be used uninitialized in this function [-Werror=

Re: Ltree syntax improvement

2020-04-02 Thread Nikita Glukhov
On 02.04.2020 2:46, Tom Lane wrote: Nikita Glukhov writes: [ latest version of ltree syntax extension ] This is going to need another rebase after all the other ltree hacking that just got done. However, I did include 0001 (use a switch) in the commit I just pushed, so you don't ne

Re: fix for BUG #3720: wrong results at using ltree

2020-03-30 Thread Nikita Glukhov
On 31.03.2020 1:35, Tom Lane wrote: Nikita Glukhov writes: And we even can simply transform this tail call into a loop: -if (tlen > 0 && qlen > 0) +while (tlen > 0 && qlen > 0) Yeah, the same occurred to me ... and then we can drop the other loop too. I think n

Re: fix for BUG #3720: wrong results at using ltree

2020-03-30 Thread Nikita Glukhov
Let me see what I can do with the comments. Thanks. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: fix for BUG #3720: wrong results at using ltree

2020-03-30 Thread Nikita Glukhov
at we can't fall into next "while" loop. The rest code in 0001 and 0002 is unchanged. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company >From b30c07ec318edefdcc9faa6c2158f4bb56114789 Mon Sep 17 00:00:00 2001 From: Nikita Glukhov Da

Re: fix for BUG #3720: wrong results at using ltree

2020-03-27 Thread Nikita Glukhov
ly with the same two complaints as Alexander ... On Wed, Jul 17, 2019 at 09:33:46PM +0300, Alexander Korotkov wrote: Hi Nikita, On Tue, Jul 16, 2019 at 6:52 PM Nikita Glukhov wrote: I looked at "ltree syntax improvement" patch and found two more very old bugs in ltree/lquery (fixes are attach

Re: Ltree syntax improvement

2020-03-26 Thread Nikita Glukhov
On 25.03.2020 2:08, Tom Lane wrote: Nikita Glukhov writes: Attached new version of the patch. I spent a little bit of time looking through this, and have a few comments: * You have a lot of places where tests for particular ASCII characters are done like this: if ((charlen == 1

Re: SQL/JSON: functions

2020-03-23 Thread Nikita Glukhov
Attached 47th version of the patches. On 21.03.2020 22:38, Pavel Stehule wrote: On 21. 3. 2020 v 11:07 Nikita Glukhov <mailto:n.glu...@postgrespro.ru>> wrote: Attached 46th version of the patches. On 20.03.2020 22:34, Pavel Stehule wrote: On 19.03.2020 23:57 Nikit

Re: SQL/JSON: functions

2020-03-21 Thread Nikita Glukhov
Attached 46th version of the patches. On 20.03.2020 22:34, Pavel Stehule wrote: čt 19. 3. 2020 v 23:57 odesílatel Nikita Glukhov mailto:n.glu...@postgrespro.ru>> napsal: Attached 45th version of the patches. Nodes JsonFormat, JsonReturning, JsonPassing, JsonBehavior were

Re: [PATCH] Opclass parameters

2020-03-17 Thread Nikita Glukhov
tches. I added empty XxxAttOptions for all AMs in patch #7, and GistAttOptions and GinAttOptions now are included into corresponding structures for opclass options. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company 0001-Introduce-opclass-para

Re: Ltree syntax improvement

2020-03-06 Thread Nikita Glukhov
hink about the whitespace business. It looks like what you propose is to strip unquoted leading and trailing whitespace but allow embedded whitespace. There's precedent for that, certainly, but I wonder whether it isn't too confusing. In any case you didn't document that.

Re: jsonpath syntax extensions

2020-03-04 Thread Nikita Glukhov
On 04.03.2020 19:13, David Steele wrote: Hi Nikita, On 2/27/20 10:57 AM, Nikita Glukhov wrote: Attached patches implement several useful jsonpath syntax extensions. I already published them two years ago in the original SQL/JSON thread, but then after creation of separate threads for SQL

Re: [PATCH] Opclass parameters

2020-02-28 Thread Nikita Glukhov
Attached new version of the patches. On 12.09.2019 3:16, Tomas Vondra wrote: On Wed, Sep 11, 2019 at 01:44:28AM +0300, Nikita Glukhov wrote: On 11.09.2019 1:03, Tomas Vondra wrote: On Tue, Sep 10, 2019 at 04:30:41AM +0300, Nikita Glukhov wrote: 2. New AM method amattoptions

jsonpath syntax extensions

2020-02-27 Thread Nikita Glukhov
same as ordinary array subscription syntax. -- non-existent $.x is simply skipped in lax mode SELECT jsonb_path_query('{"a": "b", "b": "c"}', 'pg $[$.a, "x", "a"]'); jsonb_path_query -- "c&

Re: Avoid full GIN index scan when possible

2019-12-26 Thread Nikita Glukhov
{}' | 52 | 57 |255 a @> '{}' and b @> '{}' and c @> '{}' | 51 | 58 |290 In the older version of the patch I tried to do the similar things (initialize only one NOT_NULL entry for the first column), but refused to do

Re: Avoid full GIN index scan when possible

2019-11-22 Thread Nikita Glukhov
" keys using consistentFn(). Performance of "empty-ALL [AND empty-ALL ...]" case now is the same as on master. 4. Avoid full scan in "non-empty-ALL AND regular" case. New variant of list-merging logic added to scanGetItem(). On 07.08.2019 23:32, Tom Lane wrote: Ni

Re: SQL/JSON: JSON_TABLE

2019-11-21 Thread Nikita Glukhov
On 17.11.2019 13:35, Pavel Stehule wrote: Hi út 12. 11. 2019 v 22:51 odesílatel Nikita Glukhov mailto:n.glu...@postgrespro.ru>> napsal: On 12.11.2019 20:54, Pavel Stehule wrote: > Hi > > please, can you rebase 0001-SQL-JSON-functions-v40.patch. I have a

Re: Add json_object(text[], json[])?

2019-10-24 Thread Nikita Glukhov
'm happy to add this myself if other folks want it. Regards, You can simply use jsonb_object_agg() to build a jsonb object from a sequence of transformed key-value pairs: SELECT COALESCE(jsonb_object_agg(REPLACE(k, '_', '-'), jso

Re: SQL/JSON: functions

2019-10-21 Thread Nikita Glukhov
On 21.10.2019 19:00, Andrew Alsup wrote: On 9/27/19 9:42 PM, Nikita Glukhov wrote: Attached 39th version of the patches rebased onto current master. I am unable to cleanly apply this patch. I've tried applying to the current master (4f4061b2dd) I've also tried apply to commit b81a9

Re: Fix parsing of identifiers in jsonpath

2019-10-02 Thread Nikita Glukhov
Attached v2 patch rebased onto current master. On 18.09.2019 18:10, Nikita Glukhov wrote: Unfortunately, jsonpath lexer, in contrast to jsonpath parser, was written by Teodor and me without a proper attention to the stanard. JSON path lexics is is borrowed from the external ECMAScript [1

Re: Support for jsonpath .datetime() method

2019-09-27 Thread Nikita Glukhov
* have_error flag is expected to be not-NULL always  * fixed errhint() message style [1] https://www.postgresql.org/message-id/32308.1569455803%40sss.pgh.pa.us -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company >From 81d8de2f1d0e0d4ec44729d3d2976b1e63

Re: Bug in GiST paring heap comparator

2019-09-24 Thread Nikita Glukhov
On 20.09.2019 0:15, Nikita Glukhov wrote: On 19.09.2019 22:14, Alexander Korotkov wrote: Pushed. Attached patch fixes premature xs_orderbynulls[] assignment.  The old value of NULL flag, not the new, should be checked before pfree()ing the old value. Attached another one-line patch that

Re: Bug in GiST paring heap comparator

2019-09-19 Thread Nikita Glukhov
On 19.09.2019 22:14, Alexander Korotkov wrote: Pushed. Attached patch fixes premature xs_orderbynulls[] assignment.  The old value of NULL flag, not the new, should be checked before pfree()ing the old value. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian

Fix parsing of identifiers in jsonpath

2019-09-18 Thread Nikita Glukhov
Continue" in Postgres, and what ZWNJ/ZWJ is. Now, identifier's starting character set is simply determined by the exclusion of all recognized special characters. The patch is not so simple, but I believe that it's not too late to fix v12. [1] https://www.ecma-international.org/ec

Re: SQL/JSON: JSON_TABLE

2019-09-16 Thread Nikita Glukhov
one patch. Patch 0001 is simply a squash of all 7 patches from the thread "SQL/JSON: functions". These patches are preliminary for JSON_TABLE. Patch 0002 only needs to be review in this thread. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: Bug in GiST paring heap comparator

2019-09-16 Thread Nikita Glukhov
On 13.09.2019 20:17, Alexander Korotkov wrote: On Fri, Sep 13, 2019 at 5:23 PM Nikita Glukhov wrote: I have moved handling of NULL ordering keys from opclasses to the common SP-GiST code, but really I don't like how it is implemented now. Maybe it's worth to move handling of NUL

Re: Bug in GiST paring heap comparator

2019-09-13 Thread Nikita Glukhov
On 12.09.2019 16:45, Alexander Korotkov wrote: On Wed, Sep 11, 2019 at 3:34 AM Nikita Glukhov wrote: On 09.09.2019 22:47, Alexander Korotkov wrote: On Mon, Sep 9, 2019 at 8:32 PM Nikita Glukhov wrote: On 08.09.2019 22:32, Alexander Korotkov wrote: On Fri, Sep 6, 2019 at 5:44 PM Alexander

Re: Bug in GiST paring heap comparator

2019-09-10 Thread Nikita Glukhov
On 09.09.2019 22:47, Alexander Korotkov wrote: On Mon, Sep 9, 2019 at 8:32 PM Nikita Glukhov wrote: On 08.09.2019 22:32, Alexander Korotkov wrote: On Fri, Sep 6, 2019 at 5:44 PM Alexander Korotkov wrote: I'm going to push both if no objections. So, pushed! Two years ago there

Re: [PATCH] Opclass parameters

2019-09-10 Thread Nikita Glukhov
On 11.09.2019 1:03, Tomas Vondra wrote: On Tue, Sep 10, 2019 at 04:30:41AM +0300, Nikita Glukhov wrote: 2. New AM method amattoptions().   amattoptions() is used to specify per-column AM-specific options.   The example is signature length for bloom indexes (patch #3). I'm som

Re: [PATCH] Opclass parameters

2019-09-10 Thread Nikita Glukhov
s() at src/backend/commands/opclasscmds.c -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: Bug in GiST paring heap comparator

2019-09-09 Thread Nikita Glukhov
b3728%40postgrespro.ru Sorry that I looked at this thread too late. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: Avoid full GIN index scan when possible

2019-08-02 Thread Nikita Glukhov
ery_int)) Buffers: shared hit=5 Planning Time: 0.059 ms Execution Time: 0.040 ms (9 rows) Patch #3 again contains a similar ugly solution -- we have to remove already initialized GinScanKeys with theirs GinScanEntries. GinScanEntries can be shared, so the reference counting was adde

Re: Support for jsonpath .datetime() method

2019-07-23 Thread Nikita Glukhov
e DCH_ZONED 0x04 I think you mean do_to_timestamp() here. These terms "dated" etc. are from the SQL standard text, but they should be explained somewhere for the readers of the code. [1] https://www.postgresql.org/message-id/885de241-5a51-29c8-a6b3-f1dda22aba13%40postgrespro.ru -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: Psql patch to show access methods info

2019-07-22 Thread Nikita Glukhov
le access method properties Name | Type | Handler| Description --+---+--+-- heap | table | heap_tableam_handler | heap table access method (1 row) Columns "Handler" and "Description" were added to \dA+. \dA [NAME] now shows only amn

Re: Ltree syntax improvement

2019-07-17 Thread Nikita Glukhov
0 -CONTEXT:  while creating return value -PL/Python function "test2" +          test2 +- + "['foo', 'bar', 'baz']" +(1 row) + See attached. I'm not familiar enough wi

Re: fix for BUG #3720: wrong results at using ltree

2019-07-16 Thread Nikita Glukhov
nt to '*{a+b+c}' (as I expect): SELECT ltree '1.2' ~ '*{2}'; ?column? -- t (1 row) -- expected true SELECT ltree '1.2' ~ '*{1}.*{1}'; ?column? -- f (1 row) Maybe these two bugs need a

Re: Psql patch to show access methods info

2019-07-15 Thread Nikita Glukhov
On 01.07.2019 14:06, Thomas Munro wrote: On Sun, Mar 31, 2019 at 2:13 PM wrote: Thanks for review. Hi Sergey, A new Commitfest is here and this doesn't apply -- could you please post a rebase? Thanks, Attached 7th version of the patches rebased onto current master. -- Nikita Gl

Re: [PATCH] kNN for btree

2019-07-12 Thread Nikita Glukhov
on of function 'int2dist' is invalid in C99 [-Werror,-Wimplicit-function-declaration] return int2dist(fcinfo); ^ btree_int2.c:97:9: note: did you mean 'int2_dist'? btree_int2.c:95:1: note: 'int2_dist' declared here int2_dist(PG_FUNCTION_ARGS) ^ 1 error ge

Re: Add missing operator <->(box, point)

2019-07-08 Thread Nikita Glukhov
Attached 3rd version of the patches. On 02.07.2019 21:55, Alexander Korotkov wrote: On Tue, Jul 2, 2019 at 9:19 PM Nikita Glukhov wrote: We could use commuted "const <-> var" operators for kNN searches, but the current implementation requires the existence of "var <

Re: Add missing operator <->(box, point)

2019-07-02 Thread Nikita Glukhov
| <->(polygon,point) spgist | box_ops | spgist | kd_point_ops | <->(point,point) spgist | poly_ops | <->(polygon,point) spgist | quad_point_ops| <->(point,point) (9 rows) We could use commuted "const <-> var" ope

Re: [PATCH] kNN for btree

2019-07-01 Thread Nikita Glukhov
On 01.07.2019 13:41, Thomas Munro wrote: On Tue, Mar 26, 2019 at 4:30 AM Nikita Glukhov wrote: Fixed two bugs in patches 3 and 10 (see below). Patch 3 was extracted from the main patch 5 (patch 4 in v9). This patch no longer applies so marking Waiting on Author. Attached 11th version of the

Re: Avoid full GIN index scan when possible

2019-06-28 Thread Nikita Glukhov
27;%1%'::text)) Rows Removed by Index Recheck: 2 Heap Blocks: exact=114 -> Bitmap Index Scan on test_t_idx (cost=0.00..20.42 rows=42 width=0) (actual time=0.271..0.271 rows=302 loops=1) Index Cond: ((t ~~ '%1234%'::text) AND (t ~~ '%1%

Re: [PATCH] kNN for btree

2019-03-25 Thread Nikita Glukhov
On 25.03.2019 11:17, David Steele wrote: On 3/15/19 2:11 AM, Nikita Glukhov wrote: Attached 10th versions of the patches. Fixed two bugs in patches 3 and 10 (see below). Patch 3 was extracted from the main patch 5 (patch 4 in v9). This patch no longer applies so marking Waiting on Author

Re: jsonpath

2019-03-22 Thread Nikita Glukhov
v8 > 0123 83 v8 > 000.1 Uncaught SyntaxError: Unexpected number v8> .1 0.1 Attached patch 0003 fixes this issue. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company >From 5b0844d77f4fe65d666072356f7c0e42d13c9a63 Mon Sep 17 00:00:00 2001 From: Ni

Re: jsonpath

2019-03-21 Thread Nikita Glukhov
sonb_path_match( '{ "a": 1, "b": 2,"c": "str" }', '{ "a": 1, "b": @ > 1, * : @.type == "string" }' ) Below are some possible name variants: jsonb_path_predicate() (original name) jsonb_path_

Re: Psql patch to show access methods info

2019-03-20 Thread Nikita Glukhov
lt | Storage | Stats target | Desc ription +--+---+--+-+------+--+- a | text | | | | extended | | Indexes: "x_a_idx" btree (a varchar_ops) - "x_a_idx1" btree (a DESC NULLS LAST) + "x_a_idx1" btree (a DESC NULLS LAST), Clusteratble Access method: heap # I'm not sure "clusterable" makes sense.. regards. -- Nikita Glukhov Postgres Professional:http://www.postgrespro.com The Russian Postgres Company

Re: jsonpath

2019-03-17 Thread Nikita Glukhov
'{x,0,y}' using jsonb statistics for columns "js". So the selectivity of expressions js -> 'x' -> 0 -> 'y' = '123' js #> '{x,0,y}' >= '123' also can be estimated (but these expressions can't b

Re: [PATCH] kNN for btree

2019-03-14 Thread Nikita Glukhov
mplifies a bit ammatchorderby() functions, because they should not care about the length of returned pathkey list, they simply return after the first unsupported pathkey. I event think that ammacthorderby() should not depend on whether we support incremental sorting or not. -- Nikita Glukhov

Re: WIP: BRIN multi-range indexes

2019-03-12 Thread Nikita Glukhov
t_procinfo() minmax_multi_get_procinfo() Attached patches with all my changes. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company 0001-Pass-all-keys-to-BRIN-consistent-function-at-once-20190312.patch.gz Description: application/gzip 0002-Move-IS-NOT-N

Add missing operator <->(box, point)

2019-03-10 Thread Nikita Glukhov
t;-> to SP-GiST. Changed only catalog and tests. Box case is already checked in spg_box_quad_leaf_consistent(): out->recheckDistances = distfnoid == F_DIST_POLYP; -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company >From c2655e83ae0bd779

Re: [PATCH] kNN for btree

2019-03-06 Thread Nikita Glukhov
give a feedback on them in the week. P.S. many thanks for splitting the code into separate patches. It made review a lot easier. The new status of this patch is: Waiting on Author [1] https://www.postgresql.org/message-id/CAPpHfdstf812dYObwMeu54P5HijHgURNdoJRc3jKxRj2LsQJRg%40mail.gmail.com -

Re: patch tester symbols

2019-03-06 Thread Nikita Glukhov
. I included it into this patch set just for testing in patch-tester (I guess patch-tester cannot handle patch dependencies). If you apply SQL/JSON patch sets step by step, then you need to apply only patch 0002 from "SQL/JSON: functions" and "SQL/JSON: JSON_TABLE". -- Ni

Re: Fix memleaks and error handling in jsonb_plpython

2019-03-05 Thread Nikita Glukhov
On 05.03.2019 6:45, Michael Paquier wrote: On Fri, Mar 01, 2019 at 05:24:39AM +0300, Nikita Glukhov wrote: Unfortunately, contrib/jsonb_plpython still contain a lot of problems in error handling that can lead to memory leaks: - not all Python function calls are checked for the success

Re: SQL/JSON: JSON_TABLE

2019-03-01 Thread Nikita Glukhov
On 01.03.2019 19:17, Robert Haas wrote: On Thu, Feb 28, 2019 at 8:19 PM Nikita Glukhov wrote: Attached 34th version of the patches. Kinda strange version numbering -- the last post on this thread is v21. For simplicity of dependence tracking, version numbering of JSON_TABLE patches matches

Fix memleaks and error handling in jsonb_plpython

2019-02-28 Thread Nikita Glukhov
only in OOM case. Attached patch with the fix. Back-patch for PG11 is needed. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company >From e40a9012c38c3b66888791d3dd3943adf9f310c8 Mon Sep 17 00:00:00 2001 From: Nikita Glukhov Date: Tue, 15 Jan 2019 02

Optimization of some jsonb functions

2019-02-21 Thread Nikita Glukhov
ments(js) | 1255.210 | 1205.939 jsonb_array_elements(js)::numeric | 1662.550 | 1576.227 -5% jsonb_array_elements_text(js) | 1555.021 | 1067.031 -30% js @> '1' | 798.858 | 768.664

Re: jsonpath

2019-01-28 Thread Nikita Glukhov
So I think it's worth trying to add some kind of flag 'throwErrors' to jsonb_path_query*() functions. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: jsonpath

2019-01-21 Thread Nikita Glukhov
second .keyvalue() is '$.a.b.keyvalue()' Id of '$' is 0. Id of '$var' is its ordinal (positive) number in the list of variables. Ids for generated objects are assigned using global counter 'JsonPathExecContext.generatedObjectId' starting from 'numb

Re: [PATCH] Opclass parameters

2018-12-05 Thread Nikita Glukhov
Attached 3rd version of the patches. On 20.11.2018 14:15, Nikolay Shaplov wrote: В письме от 15 ноября 2018 18:26:43 пользователь Nikita Glukhov написал: Attached 2nd version of the patches. Nothing has changed since March, this is just a rebased version. CREATE INDEX syntax and parameters

Re: Jsonb transform for pl/python

2018-09-27 Thread Nikita Glukhov
18 at 2:11 PM Nikita Glukhov wrote: I found a memory leak in PLySequence_ToJsonbValue(): PyObject returned from PySequence_GetItem() is not released. A bug can be easily reproduced using function roudtrip() from regression test: SELECT roundtrip('[1,2,3]'::jsonb) FROM generate_series(1

Re: jsonpath

2018-08-22 Thread Nikita Glukhov
Attached 17th version of the patches rebased onto the current master. Nothing significant has changed. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company sqljson_jsonpath_v17.tar.gz Description: application/gzip

Re: [HACKERS] [PATCH] kNN for SP-GiST

2018-07-17 Thread Nikita Glukhov
Attached 7th version of the patches: * renamed recheck fields and variables * fixed formatting of the one if-statement On 15.07.2018 14:54, Andrey Borodin wrote: 14.07.2018, 1:31, Nikita Glukhov wrote: Attached 6th version of the patches. ... 2. The patch leaves contribs intact. Do

Re: [HACKERS] [PATCH] kNN for SP-GiST

2018-07-13 Thread Nikita Glukhov
Attached  6th version of the patches. On 09.07.2018 20:47, Andrey Borodin wrote: 4 июля 2018 г., в 3:21, Nikita Glukhov написал(а): Attached 5th version of the patches, where minor refactoring of distance handling was done (see below). I'm reviewing this patch. Currently I'm

Re: [PATCH] Add missing type conversion functions for PL/Python

2018-07-12 Thread Nikita Glukhov
On 11.07.2018 21:03, Heikki Linnakangas wrote: On 26/03/18 19:07, Nikita Glukhov wrote: Attached fixed 3th version of the patch: Thanks, I'm reviewing this now. Nice speedup! Thank you for your review. There is no test coverage for some of the added code. You can get a code cov

Re: [HACKERS] [PATCH] kNN for SP-GiST

2018-07-03 Thread Nikita Glukhov
Attached 5th version of the patches, where minor refactoring of distance handling was done (see below). On 02.07.2018 19:06, Alexander Korotkov wrote: Hi! On Fri, Jun 29, 2018 at 5:37 PM Nikita Glukhov wrote: On 06.03.2018 17:30, David Steele wrote: I agree with Andres. Pushing this

Re: jsonpath

2018-07-02 Thread Nikita Glukhov
On 28.06.2018 05:39, Thomas Munro wrote: On Thu, Jun 28, 2018 at 11:38 AM, Nikita Glukhov wrote: Attached 15th version of the patches. Hi Nikita, I wonder why the Windows build scripts are not finding and processing your new .y and .l files: https://ci.appveyor.com/project/postgresql-cfbot

Re: [HACKERS] [PATCH] kNN for SP-GiST

2018-06-29 Thread Nikita Glukhov
On 06.03.2018 17:30, David Steele wrote: I agree with Andres. Pushing this patch to the next CF. Attached 4th version of the patches rebased onto the current master. Nothing interesting has changed from the previous version. -- Nikita Glukhov Postgres Professional: http

Re: SQL/JSON: documentation

2018-06-28 Thread Nikita Glukhov
On 28.06.2018 05:23, Chapman Flack wrote: On 06/27/2018 07:36 PM, Nikita Glukhov wrote: Also it can be found in our sqljson repository on sqljson_doc branch: https://github.com/postgrespro/sqljson/tree/sqljson_doc Perhaps it is my unfamiliarity, but it seems that on lines 1067–1071, the

Re: jsonpath

2018-06-27 Thread Nikita Glukhov
tation has been moved into a separate patch (see https://www.postgresql.org/message-id/732208d3-56c3-25a4-8f08-3be1d54ad51b%40postgrespro.ru). -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company sqljson_jsonpath_v15.tar.gz Description: application/gzip

Re: Psql patch to show access methods info

2018-06-25 Thread Nikita Glukhov
x27;s properties in the separate table for each index, because it is not so easy to understand the combined table. The same, perhaps, can be applied to \dAfp and \dAfo commands. I also have a question about testing commands \dAf+ and \dAoc+: is it good idea to test them by changing a

Re: Jsonb transform for pl/python

2018-06-22 Thread Nikita Glukhov
_json 9887,821 ms - returning float arrays (output transformation): py_jsonb_ret_float_array_trans opt 5699,360 ms py_jsonb_ret_float_array_trans 5735,854 ms py_jsonb_ret_float_array_raw 6516,514 ms py_jsonb_ret_float_array_json 10869,213 ms -- Nikita Glukhov Pos

Re: Jsonb transform for pl/python

2018-06-15 Thread Nikita Glukhov
On 28.03.2018 15:43, Peter Eisentraut wrote: On 3/21/18 18:50, Peter Eisentraut wrote: On 3/12/18 11:26, Nikita Glukhov wrote: I have reviewed this patch. Attached new 6th version of the patch with v5-v6 delta-patch. Thanks for the update. I'm working on committing this. Comm

[BUGFIX] amcanbackward is not checked before building backward index paths

2018-05-15 Thread Nikita Glukhov
. Obviously, this can lead to misuse of Backward Index [Only] Scan plans. Attached patch with the corresponding fix. There are no test cases because now only btree supports ordered scans but it supports backward scans too. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian

Re: jsonpath

2018-03-27 Thread Nikita Glukhov
ntation of error handling in jsonpath, please tell us about them. Now we can offer only two variants described above, but we understand that some future work is necessary to support such standard features in PostgreSQL without having problems with PG_TRY/PG_CATCH. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company sqljson_jsonpath_v14.tar.gz Description: application/gzip

Re: [PATCH] Add missing type conversion functions for PL/Python

2018-03-26 Thread Nikita Glukhov
I/O functions * fixed whitespace -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c index d6a6a84..3b874e1 100644 --- a/src/pl/plpython/plpy_typeio.c +++ b/src/pl/plpython/

Re: jsonpath

2018-03-15 Thread Nikita Glukhov
Attached 13th version of the jsonpath patches. Syntax of .** accessor (our extension to standard) was changed to become more similar to the syntax of the standard array accessor: .**{2, 5} => .**{2 to 5} .**{3,} => .**{3 to last} -- Nikita Glukhov Postgres Professional

Re: Transform for pl/perl

2018-03-13 Thread Nikita Glukhov
* + * Transform Jsonb into SV  ---< should be SV to Jsonb + */ +PG_FUNCTION_INFO_V1(plperl_to_jsonb); +Datum Fixed. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company diff --git a/contrib/Makefile b/contrib/Makefile index 8046ca4..53d44fe 100644 --

Re: Jsonb transform for pl/python

2018-03-12 Thread Nikita Glukhov
tate ** to PyXxx_ToJsonbValue() functions. * Added transformation of Python tuples into JSON arrays because standard Python JSONEncoder encoder does the same. (See https://docs.python.org/2/library/json.html#py-to-json-table) -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russia

Re: jsonpath

2018-03-07 Thread Nikita Glukhov
On 02.03.2018 00:57, Alexander Korotkov wrote: On Fri, Mar 2, 2018 at 12:40 AM, Nikita Glukhov mailto:n.glu...@postgrespro.ru>> wrote: On 28.02.2018 06:55, Robert Haas wrote: On Mon, Feb 26, 2018 at 10:34 AM, Nikita Glukhov mailto:n.glu...@postgrespro.ru&g

Re: jsonpath

2018-03-05 Thread Nikita Glukhov
h seem like a valid issues, I think. regards -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company sqljson_jsonpath_v11.tar.gz Description: application/gzip

Re: [PATCH] Opclass parameters

2018-03-02 Thread Nikita Glukhov
eed to сome to an agreement about CREATE INDEX syntax and where to store the opclass parameters. -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: jsonpath

2018-03-01 Thread Nikita Glukhov
On 28.02.2018 06:55, Robert Haas wrote: On Mon, Feb 26, 2018 at 10:34 AM, Nikita Glukhov wrote: Attached 10th version of the jsonpath patches. 1. Fixed error handling in arithmetic operators. Now run-time errors in arithmetic operators are catched (added PG_TRY/PG_CATCH around

Re: [PATCH][PROPOSAL] Add enum releation option type

2018-03-01 Thread Nikita Glukhov
alues[]. This helps not to expose default values definitions (like GIST_BUFFERING_AUTO defined in gistbuild.c). My github repository: https://github.com/glukhovn/postgres/tree/enum-reloptions -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company diff --

Re: Cast jsonb to numeric, int, float, bool

2018-03-01 Thread Nikita Glukhov
7;"1234567890.1234567890"', '$' RETURNING numeric ERROR ON ERROR); json_value --- 1234567890.1234567890 (1 row) =# SELECT JSON_VALUE('"foo"', '$' RETURNING numeric ERROR ON ERROR); ERROR: invalid input syntax for type numeric: "foo" =# SELECT JSON_VALUE('null', '$' RETURNING numeric ERROR ON ERROR); json_value (1 row) =# SELECT JSON_VALUE('{}', '$' RETURNING numeric ERROR ON ERROR); ERROR: SQL/JSON scalar required =# SELECT JSON_VALUE('[]', '$' RETURNING numeric ERROR ON ERROR); ERROR: SQL/JSON scalar required -- Nikita Glukhov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company

Re: Cast jsonb to numeric, int, float, bool

2018-02-28 Thread Nikita Glukhov
ALUE(jb, '$.key' RETURNING datatype ERROR ON ERROR) or JSON_VALUE(jb, '$.key' RETURNING datatype [NULL ON ERROR]). But if we want to have NULL ON ERRORbehavior (which is default in SQL/JSON) in casts, then casts should not throw any errors. -- Nikita Glukhov Postgres Professiona

Re: [HACKERS] [PATCH] kNN for SP-GiST

2018-02-28 Thread Nikita Glukhov
ps-and-circle_ops-v02.patch I think this is out of scope for KNN SP-GiST.  This is very valuable, but completely separate feature.  And it should be posted and discussed separately. Compress method for SP-GiST with poly_ops already have been committed, so I left only ordering operators for pol

  1   2   >