Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.keyarray(json '{ "":0 }') fails with error: Could not allocate space #6858

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2020-05-01 21:46:07 +0200
From: Martin van Dinther <<martin.van.dinther>>
To: SQL devs <>
Version: 11.35.19 (Nov2019-SP3)
CC: @kutsurak

Last updated: 2020-07-27 09:30:15 +0200

Comment 27690

Date: 2020-05-01 21:46:07 +0200
From: Martin van Dinther <<martin.van.dinther>>

User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:74.0) Gecko/20100101 Firefox/74.0
Build Identifier:

json.keyarray(json '{ "":0 }') should return: [""].
Instead it returns: Error: Could not allocate space
This is probably due to uninitialised/incorrect length when allocating memory as:
json.keyarray(json '{ "a":0 }') returns: ["a"].

Note json.isvalid(json '{ "":0 }')
and json.isobject(json '{ "":0 }')
both return true so '{ "":0 }' is a valid json object.

Reproducible: Always

Steps to Reproduce:

select json.keyarray(json '{ "":0 }');
-- returns: Error: Could not allocate space
select json.isvalid(json '{ "":0 }');
select json.isobject(json '{ "":0 }');
-- returns: true

select json.keyarray(json '{ "":"" }');
select json.isvalid(json '{ "":"" }');
select json.isobject(json '{ "":"" }');

select json.keyarray(json '{ "a":0 }');
-- returns: ["a"]

Actual Results:

sql>select json.keyarray(json '{ "":0 }');
Could not allocate space
sql>select json.isvalid(json '{ "":0 }');
+-------+
| L2 |
+=======+
| true |
+-------+
1 tuple
sql>select json.isobject(json '{ "":0 }');
+-------+
| L2 |
+=======+
| true |
+-------+
1 tuple
sql>
sql>select json.keyarray(json '{ "":"" }');
Could not allocate space
sql>select json.isvalid(json '{ "":"" }');
+-------+
| L2 |
+=======+
| true |
+-------+
1 tuple
sql>select json.isobject(json '{ "":"" }');
+-------+
| L2 |
+=======+
| true |
+-------+
1 tuple
sql>
sql>select json.keyarray(json '{ "a":0 }');
+-------+
| L2 |
+=======+
| ["a"] |
+-------+
1 tuple
sql>

Expected Results:

sql>select json.keyarray(json '{ "":0 }');
+------+
| L2 |
+======+
| [""] |
+------+
1 tuple
sql>select json.keyarray(json '{ "":"" }');
+------+
| L2 |
+======+
| [""] |
+------+
1 tuple

See JSONkeyArray(json *ret, json *js) in
https://dev.monetdb.org/hg/MonetDB/file/Nov2019/monetdb5/modules/atoms/json.c

Comment 27851

Date: 2020-06-15 17:42:22 +0200
From: MonetDB Mercurial Repository <>

Changeset c932190780ff made by Pedro Ferreira pedro.ferreira@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=c932190780ff

Changeset description:

Added test for bug #6858

Comment 27868

Date: 2020-06-22 13:42:44 +0200
From: MonetDB Mercurial Repository <>

Changeset e5f5ab2d3769 made by Panagiotis Koutsourakis kutsurak@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=e5f5ab2d3769

Changeset description:

Handle empty strings correctly in JSONkeyArray

This fixes Bug #6858

Comment 27869

Date: 2020-06-22 13:42:48 +0200
From: MonetDB Mercurial Repository <>

Changeset 1ba2ed8873df made by Panagiotis Koutsourakis kutsurak@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=1ba2ed8873df

Changeset description:

Add test results for Bug #6858
@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants