On Tue, Dec 16, 2008 at 11:37:17PM +0300, Иван Марков wrote:
> Hello. I have table classif with columns:
> ... , group1, group2, group3, ... , group48, ...
That's a very poor design because it's both denormalized and has very
poor naming. There are likely plenty of other things wrong with it,
too
On Tue, Dec 16, 2008 at 11:37:17PM +0300, wrote:
> Hello. I have table classif with columns:
> ... , group1, group2, group3, ... , group48, ...
>
> In function i do query and want run on every row and dynamically operate on
> columns from group1 to group20. I do something like this:
It s
age-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ivan Pavlov
Sent: Tuesday, December 16, 2008 3:55 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Need help to dynamically access to colomns in function!
If you need them one by one
If you need them one by one why fetch them into tmprec? Take a look at
the docs for FETCH:
http://www.postgresql.org/docs/8.3/static/sql-fetch.html
especially the FETCH ABSOLUTE...
regards,
Ivan Pavlov
On Dec 16, 3:37 pm, aesthete2...@gmail.com ("Иван Марков") wrote:
> Hello. I have table class
Please disregard my other message. I didn't get what you are trying to
do at first.
You can do this with dynamic SQL: Look at 38.5.4. Executing Dynamic
Commands (http://www.postgresql.org/docs/current/static/plpgsql-
statements.html).
I guess something like
EXECUTE 'SELECT tmprec.group' || i INTO
Hello. I have table classif with columns:
... , group1, group2, group3, ... , group48, ...
In function i do query and want run on every row and dynamically operate on
columns from group1 to group20. I do something like this:
OPEN curs FOR select * from classif;
loop
fetch curs into tmprec;