Thanks Thomas! Sorry to say this but ,this was migrated from Oracle to PG :) and the app team just wants to keep the data type as it is :(
On Wed, Nov 24, 2021 at 5:40 PM Thomas Kellerer <shammat@xxxxxxx> wrote:
aditya desai schrieb am 24.11.2021 um 08:35:
> Hi Thomas,
> v_message is of composite data type r_log_message and it's definition is as shown below.
>
> postgres=# \d r_log_message;
> Composite type "public.r_log_message"
> Column | Type | Collation | Nullable | Default
> -------------+-------------------------+-----------+----------+---------
> column_name | character varying(30) | | |
> oldvalue | character varying(4000) | | |
> newvalue | character varying(4000) | | |
>
> Regards,
> Aditya.
Sorry, didn't see that.
Then you need to create records of that type in the array:
v_message := array[('empName', old.empname, new.empname)::r_log_message, ('location', old.location, new.location)::r_log_message];
or an array of that type:
v_message := array[('empName', old.empname, new.empname), ('location', old.location, new.location)]::r_log_message[];
Btw: why don't you use `text` instead of varchar(4000).