18
Qual è il modo migliore per aggiungere un elemento a un array quando non viene fornita la dimensione dell'array?Postgres Array Append & Array Length per 'Array Push'
Con array_append
questo è quello che mi viene in mente:
UPDATE table SET array = array_append((SELECT array FROM table WHERE ...), 'element') WHERE ...;
Con array_length
questo è quello che mi viene in mente:
UPDATE table SET array[array_length((SELECT array FROM table WHERE ...), 1)+1] = element;
Quindi vuoi aggiungere ''elemento'' a' table.array'? –
sì .. aggiungi 'elemento' a un 'array' nella' colonna table.array'. –