Re: How to assign variable in array value inside function proc.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: aditya desai <admad123(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: How to assign variable in array value inside function proc.
Date: 2021-11-01 16:53:34
Message-ID: CAKFQuwaGft2SF0tcYA1NhvwiQ5Yby6-m13MzyJ9QB7TdX8KE+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Nov 1, 2021 at 9:20 AM aditya desai <admad123(at)gmail(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message aditya desai 2021-11-11 07:46:08 Constructing colum name as alias
Previous Message aditya desai 2021-11-01 16:20:11 Re: How to assign variable in array value inside function proc.