I have the table in POSTGRESQL. How can insert row if in the table is not exist or update if exist by appending array in last table (Adding to the array should add new text in last column, like “1. First;” “1. First;2.Second;” “1. First;2.Second;2.Second;” etc)?
This is my code that I want to use:
INSERT INTO public.history (arm_number, dt_action)
VALUES ('1', '{"1. First;"}')
ON CONFLICT (arm_number)
DO UPDATE SET dt_action = ARRAY_APPEND(EXCLUDED.dt_action, '2. Second;');
When I use it i got only “1. First;2.Second;” What should I do?
New contributor
Krutomerrik _ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.