0

I have the stored procedure sp_table in PostgreSQL. I wish to obtain the following result

(1,{"cola":1,"colb":"a"}) (2,{"cola":2,"colb":"b"})

With the second column in json format so that my backend can convert it into. but the sp gives me the json with double quotes.

I can only get it the way I want it when I return a column as a json as in the sp sp_only_json.

http://sqlfiddle.com/#!17/c82c1b/1

It's possible to obtain it in the desired format?

Pvn
  • 5
  • 1

1 Answers1

0

If the function returns a table, it should be used in the FROM clause to get separate columns as the result.

SELECT * FROM sp_table();

SQL Fiddle.

klin
  • 112,967
  • 15
  • 204
  • 232