Re: Like to RETURN SQL results set

From: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
To: M Sarwar <sarwarmd02(at)outlook(dot)com>
Cc: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Like to RETURN SQL results set
Date: 2024-03-29 03:54:25
Message-ID: ADC7EAFA-4743-42C6-B278-8DE2AD18700E@elevated-dev.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On Mar 28, 2024, at 9:39 PM, M Sarwar <sarwarmd02(at)outlook(dot)com> wrote:
>
> I could not follow JSON part. Do you have any case where I can see JSON is used to solve this type of problem.

To get json back, take any query and wrap it in

'select array_to_json(array_agg(row_to_json(t)))::text from (' || query || ') as t;'

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message M Sarwar 2024-03-29 03:57:27 Re: Like to RETURN SQL results set
Previous Message M Sarwar 2024-03-29 03:39:35 Re: Like to RETURN SQL results set