Re: Need help to dynamically access to colomns in function!

From: David Fetter <david(at)fetter(dot)org>
To: Иван Марков <aesthete2005(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Need help to dynamically access to colomns in function!
Date: 2008-12-17 21:45:30
Message-ID: 20081217214530.GG6793@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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. Check http://thedailywtf.com/ for systems similar to yours. I
suspect it won't take long to find some.

> 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:

Nothing will really help until you fix your design, and dynamic
querying will only lead you further down this rat-hole.

The answer to, "how do I shoot myself in the foot?" is "Don't."

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2008-12-17 22:41:19 Re: pglib.dll for windows ce
Previous Message Adrian Klaver 2008-12-17 21:25:51 Re: Copy/delete issue