Re: [SQL] plpgsql : adding record variable to table

2012-04-18 Thread Pavel Stehule
Hello please try: postgres=# create or replace function foo() returns void as $$ declare r x; begin for r in select * from x loop insert into y values(r.*); end loop; end; $$ language plpgsql; Regards Pavel 2012/4/18 thomas veymont : > (sorry my previous email was truncated) > > hi,

[SQL] plpgsql : adding record variable to table

2012-04-18 Thread thomas veymont
(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

[SQL] plpgsql : adding record variable to table

2012-04-18 Thread thomas veymont
hi, say I have the following (simplified for discussion) pl/pgsql function: FUNCTION myfunction ( ...) RETURNS TABLE ( elem1 integer, elem2 text, ...) DECLARE g RECORD BEGIN FOR g in SELECT colum1, column2 FROM someTable LOOP -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)

Re: [SQL] Uniform UPDATE queries

2012-04-18 Thread Tom Lane
Dennis writes: > When a query is written to update a table, the usual process is to list all > the columns that need > updating. This could imply the creation of many possible queries for many > columns. In an effort to > keep the UPDATE queries more uniform, less number of unique queries, a

Re: [SQL] Uniform UPDATE queries

2012-04-18 Thread Rob Sargent
On 04/18/2012 04:11 AM, Dennis wrote: When a query is written to update a table, the usual process is to list all the columns that need updating. This could imply the creation of many possible queries for many columns. In an effort to keep the UPDATE queries more uniform, less number of unique qu

[SQL] Uniform UPDATE queries

2012-04-18 Thread Dennis
When a query is written to update a table, the usual process is to list all the columns that need updating. This could imply the creation of many possible queries for many columns. In an effort to keep the UPDATE queries more uniform, less number of unique queries, a keyword similar to DEFAULT,