-
Notifications
You must be signed in to change notification settings - Fork 4.1k
json: AsText method unnecessarily returns pointer to string and error #81097
Copy link
Copy link
Closed
Labels
A-sql-jsonJSON handling in SQL.JSON handling in SQL.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.T-sql-queriesSQL Queries TeamSQL Queries Team
Description
Noticed while working on #80000: the method AsText() in json.JSON returns (*string, error).
I think it's silly?
- none of the methods actually return an error. It's unnecessary to pay the price of a 2nd error return.
- all of the methods create a
stringand then allocate (on the heap) a reference to it. Why not returning thestringdirectly?
Also, why not use the (edit: nvm).String() method directly, which seems to do the same?
cc @yuzefovich
Jira issue: CRDB-15147
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-jsonJSON handling in SQL.JSON handling in SQL.C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.E-quick-winLikely to be a quick win for someone experienced.Likely to be a quick win for someone experienced.T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Done