plpgsql : adding record variable to table - Mailing list pgsql-sql

From thomas veymont
Subject plpgsql : adding record variable to table
Date
Msg-id CAHcTkqqDPniDCF_eLqVrHfyYtZUXoGuh21w9_BToMSrJEbUung@mail.gmail.com
Whole thread Raw
Responses Re: plpgsql : adding record variable to table  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-sql
(sorry my previous email was truncated)

hi,

Here is what I want to do :

I want to check each row of a table against some conditions (this
check needs some
processing stuff I can easily code with pl/pgsql).

If the row is OK, I want to add it in a "resulting table",
else I just ignore the current row and go to next one.

My function looks like this : (simplified)

FUNCTION myfunction (...)  RETURNS TABLE ( elem1 , elem2, elem3 ...)
DECLARE  g RECORD
BEGINFOR g in SELECT colum1, column2, ... FROM someTable  LOOP     -- do some processing on "g", then decide wheter I
wantto
 
select it or not    IF (g is selected) THEN >>add g to resulting_table<<  END LOOP RETURN resulting_table

How should I write the "add g to resulting table" part ?

thanks,
Tom


pgsql-sql by date:

Previous
From: thomas veymont
Date:
Subject: plpgsql : adding record variable to table
Next
From: Pavel Stehule
Date:
Subject: Re: plpgsql : adding record variable to table