Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





--
Dirk Mika
Software Developer

mika:timing GmbH
Strundepark - Kürtener Str. 11b
51465 Bergisch Gladbach
Germany

fon +49 2202 2401-1197
dirk.mika@xxxxxxxxxxxxx
www.mikatiming.de

AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884
Geschäftsführer: Harald Mika, Jörg Mika



## How2Use
## the ChampionChip by mika:timing
## https://youtu.be/qfOFXrpSKLQ
Am 03.07.19, 01:39 schrieb "raf@xxxxxxx" <raf@xxxxxxx>:

    If the problem you are facing is similar in nature, you
    might be able to work around it by having a variable of
    the same type as the array elements, assign to it the
    record that you want to modify, make the modification
    in the single record variable and then assign that
    single record variable back into the array element that
    it came from.

    i.e. something like:

      declare
      a rectype[];
      r rectype;
      i  integer;
      begin
      ...
      r := a[i];
      r.field := newvalue;
      a[i] := r;
      ...

It actually works the way you suggested. Not nice, but as long as it works, it's ok ;-)

    I didn't even realise that you could have an array of records.
    I've only ever used arrays of scalar values.

Yes, if that wasn't possible, I would have had to switch to a series of Array of scalar values.

BR
Dirk








[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux