Re: How to assign variable in array value inside function proc. - Mailing list pgsql-sql

From David G. Johnston
Subject Re: How to assign variable in array value inside function proc.
Date
Msg-id CAKFQuwaGft2SF0tcYA1NhvwiQ5Yby6-m13MzyJ9QB7TdX8KE+w@mail.gmail.com
Whole thread Raw
In response to Re: How to assign variable in array value inside function proc.  (aditya desai <admad123@gmail.com>)
List pgsql-sql
On Mon, Nov 1, 2021 at 9:20 AM aditya desai <admad123@gmail.com> wrote:
Hi ,here is another issue now. If you see the last value in the source table it considers commas as separate columns and gives errors. Can you please help?

v_message:=   array(select '(' || columname || ',' || oldvalue::text || ',' || newvalue::text ||')' from testaditya2);


Please don't top-post.  Also, take the time to remove anything not necessary to provide useful context.

The only help I can give is to reiterate that trying to do string concatenation and writing out text literals for arrays and composites is something that should just be avoided.  If you cannot, learn the quoting and escaping rules for the thing you are trying to build and obey them.

David J.

pgsql-sql by date:

Previous
From: aditya desai
Date:
Subject: Re: How to assign variable in array value inside function proc.
Next
From: aditya desai
Date:
Subject: Constructing colum name as alias