Re: plpgsql: How to modify a field in an array of records

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plpgsql: How to modify a field in an array of records
Дата
Msg-id 30905.1562075577@sss.pgh.pa.us
обсуждение исходный текст
Ответ на plpgsql: How to modify a field in an array of records  (Dirk Mika <Dirk.Mika@mikatiming.de>)
Ответы Re: plpgsql: How to modify a field in an array of records  (Dirk Mika <Dirk.Mika@mikatiming.de>)
Список pgsql-general
Dirk Mika <Dirk.Mika@mikatiming.de> writes:
> But when I try to modify a field of a record in the array I get a syntax error.
> l_classes_array[i].field1 := l_value;
> The error is ERROR: syntax error at or near "." Position: 12414 where position points to the . after the [i]. I've no
ideawhat's causing this syntax error. 

Yeah, that seems like it ought to work, and ideally it would.  But plpgsql
doesn't currently have support for nested field-of-array-element or
element-of-record-field assignments.  (I've looked briefly at this in the
past, and it doesn't seem impossible, but it's definitely not trivial
either.)

You'll have to do some kind of workaround like assigning the whole array
element to a temp variable, fixing the field in the temp variable, then
assigning back :-(

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Statistics tables not being updated anymore
Следующее
От: Adrien Nayrat
Дата:
Сообщение: Re: Statistics tables not being updated anymore