dozer icon indicating copy to clipboard operation
dozer copied to clipboard

[DO NOT MERGE] demo feat: json_object support

Open chloeminkyung opened this issue 2 years ago • 2 comments

SELECT JSON_OBJECT('id: user.id', 'town: user.town', 'town_2: LA') as info FROM users

{"id": 1, "town": "Bristol", "town_2": "LA"}

chloeminkyung avatar Nov 30 '23 07:11 chloeminkyung

The syntax is a bit unusual. Can we use the SQL/JSON standard syntax instead? Ex.:

select JSON_OBJECT('id': user.id, 'town': user.town, 'town_2': 'LA')

and/or

select JSON_OBJECT('id' VALUE user.id, 'town' VALUE user.town, 'town_2' VALUE 'LA')

On advantage is that there is a clear distinction between value literals 'LA' and column references user.id.

More info: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_OBJECT.html#GUID-1EF347AE-7FDA-4B41-AFE0-DD5A49E8B370

Jesse-Bakker avatar Nov 30 '23 08:11 Jesse-Bakker

The syntax is a bit unusual. Can we use the SQL/JSON standard syntax instead? Ex.:

select JSON_OBJECT('id': user.id, 'town': user.town, 'town_2': 'LA')

and/or

select JSON_OBJECT('id' VALUE user.id, 'town' VALUE user.town, 'town_2' VALUE 'LA')

On advantage is that there is a clear distinction between value literals 'LA' and column references user.id.

More info: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/JSON_OBJECT.html#GUID-1EF347AE-7FDA-4B41-AFE0-DD5A49E8B370

yes, we are aware of that - this is hacky way to implement this feature as fast as possible, request from Bei for demo purpose. Not merging for main, of course. I have implemented this way cause of our backend limitation. We should take one of your approaches when we are implementing properly later on.

chloeminkyung avatar Nov 30 '23 08:11 chloeminkyung