Re: Attribute a value to a record

From: Florent THOMAS <mailinglist(at)tdeo(dot)fr>
To: postgesql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Attribute a value to a record
Date: 2010-02-03 09:35:30
Message-ID: 1265189730.18031.17.camel@Dell_Inspiron
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear laurenz Albe,

Thank you for answering so fast.
for me, the variable ventilation_local is defined as a record type.
So as I wrote on the other mail, I made some additionnal test because
the doc precise that the syntax above is allowed :
http://www.postgresql.org/docs/8.4/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT (last line)

I understood that in the Loop you can change the values of a variable!
Exactly what I needed.
but unfortunately all of this seems to be temporary. Consequently, the
record in the table won't be updated by the changes we made on the local
variable even if it points to a record in the table.
I forgot the aspect of the cursor that is temporary.

But in all the case, It could be a great improvement to let the syntax
modify directly the table.

I think I will find another way to do it. with EXECUTE!!

Best regards

Le mercredi 03 février 2010 à 10:05 +0100, Albe Laurenz a écrit :

> Florent THOMAS wrote:
> > I'm currently running on pg8.4 and I have a trigger with a loop :
> >
> > FOR ventilation_local IN (SELECT * FROM XXX) LOOP
> > IF (mytest) THEN
> > ventilation_local.myfield:=mynewvalue;
> > END IF;
> > END LOOP;
> >
> > my problem is that the record doen't accept the new value.
> > I've chek before the value that is not null.
> > Is it a fonctionnality accepted in pg8.4 on record type?
>
> What do you mean by "the record doen't accept the new value"?
>
> Can you show us some SQL statements that exhibit the problem?
>
> Yours,
> Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message AI Rumman 2010-02-03 09:43:55 table size is not changed
Previous Message Wang, Mary Y 2010-02-03 09:35:16 PQendcopy:resetting connection Problem and Cannot insert a duplicate key into unique index