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

only first character of the separator string in json.text(js json, sep string) is used #6859

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

Comments

@monetdb-team
Copy link

Date: 2020-05-01 22:03:56 +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:12 +0200

Comment 27691

Date: 2020-05-01 22:03:56 +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:

select json.text(json '[1,2,3,4]', 'ax');
returns '1a2a3a4'
instead of '1ax2ax3ax4'.

It appears that only the first character of the separator string 'ax' is currently used.
It should include the whole separator string as the signature allows a string and not a character.

Reproducible: Always

Steps to Reproduce:

select json.text(json '[1,2,3,4]', 'ax');
select json.text(json '[1,2,3,4]', 'test');

select func from sys.functions where name = 'text' and mod = 'json' and system;

Actual Results:

sql>select json.text(json '[1,2,3,4]', 'ax');
+---------+
| L2 |
+=========+
| 1a2a3a4 |
+---------+
1 tuple
sql>select json.text(json '[1,2,3,4]', 'test');
+---------+
| L2 |
+=========+
| 1t2t3t4 |
+---------+
1 tuple
sql>
sql>select func from sys.functions where name = 'text' and mod = 'json' and system;
+-----------------------------------------------------------------------------+
| func |
+=============================================================================+
| create function json.text(js json, e string) |
: returns string external name json.text; :
| create function json.text(js json) |
: returns string external name json.text; :
+-----------------------------------------------------------------------------+
2 tuples
sql>

Expected Results:

sql>select json.text(json '[1,2,3,4]', 'ax');
+------------+
| L2 |
+============+
| 1ax2ax3ax4 |
+------------+
1 tuple
sql>select json.text(json '[1,2,3,4]', 'test');
+------------------+
| L2 |
+==================+
| 1test2test3test4 |
+------------------+
1 tuple
sql>
sql>select func from sys.functions where name = 'text' and mod = 'json' and system;
+-----------------------------------------------------------------------------+
| func |
+=============================================================================+
| create function json.text(js json, e string) |
: returns string external name json.text; :
| create function json.text(js json) |
: returns string external name json.text; :
+-----------------------------------------------------------------------------+
2 tuples
sql>

Comment 27852

Date: 2020-06-15 17:48:24 +0200
From: MonetDB Mercurial Repository <>

Changeset 36ab2df63f09 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=36ab2df63f09

Changeset description:

Added test bug #6859

Comment 27870

Date: 2020-06-22 13:50:24 +0200
From: @kutsurak

The Documentation for json.text at https://www.monetdb.org/Documentation/SQLReference/DataTypes/JSONDataType refers to the separator as a character. I think that the expected result for

select json.text(json '[1,2,3,4]', 'ax');

should be an error. Thoughts?

Comment 27891

Date: 2020-07-06 10:22:01 +0200
From: @kutsurak

Fixed as originally intended on changeset 76211429a963

See: https//devmonetdborg/hg/MonetDB?cmd=changeset;node=76211429a963

@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