Dynamically created tables [WAS Re: "Relation x does not exist" ... - Mailing list pgsql-general

From Gaurav Priyolkar
Subject Dynamically created tables [WAS Re: "Relation x does not exist" ...
Date
Msg-id 20011016233249.F926@goatelecom.com
Whole thread Raw
In response to Re: "Relation x does not exist" error when x does exist  (merlyn@stonehenge.com (Randal L. Schwartz))
Responses Re: Dynamically created tables [WAS Re: "Relation x does not exist" ...  (merlyn@stonehenge.com (Randal L. Schwartz))
Re: Dynamically created tables [WAS Re: "Relation x  (Keary Suska <hierophant@pcisys.net>)
List pgsql-general
On Tue, Oct 16, 2001 at 01:22:45AM -0700, Randal L. Schwartz wrote:
> >>>>> "Gaurav" == Gaurav Priyolkar <gaurav_lists@yahoo.com> writes:
>
> Gaurav> Not feasible, because some functions have dynamically created
> Gaurav> tables so I need to re-create table at each invocation.
>
> When I hear that, I always think "bad design".

Perhaps there is a better way, but let me explain what I need to do.
A (temporary) table, say B, has to be created which is basically a
vertical representation of a number rows of another table, A. The data
in rows of A is interpreted differently depending on which one of a
number of groups that record belongs to, which is decided by certain
attributes which are ids.

So, a row in B is actually a number of rows from A, with the item in
each column of B corresponding to the data in one of the said rows of A.

I will try to give an example to be a little more clear: (please note
this is purely for the sake of description)
Consider A to be a table having rows with fields: city_id,  month_id
and temperature.
So B will be a table with columns city_id and a number of columns for
months. A row of B will then be the temperatures measured over a
number of months.

Now, reason for all of the above:
Apparently, when creating a Delphi report, it has to be fed with data
from a database table with exactly the columns as they are to appear
on the report. I am just meeting the specified requirement.

However, is there a better way.

Disclaimer:
Yes, I am not a Delphi programmer either.

> If the answer is "dynamically created tables", I think you asked the
> wrong question to begin with.

Sorry, I have amended my subject line as you suggested.
I had used the error message for subject thinking someone might find
it familiar and be able to help.

> It's a bit like saying "I need to invent a new language for every book
> I write".  Uh, probably not. :)

Hey, Programming Perl has gone an edition ahead of Learning Perl
... when are we going to see the Third Edition of the 'Llama book'?
No new languages til then :)

Regards,
Gaurav








pgsql-general by date:

Previous
From: huongch@bigfoot.com (Flancer)
Date:
Subject: To Postgres Devs : Wouldn't changing the select limit syntax ....
Next
From: degoble@gtech (David. E. Goble)
Date:
Subject: Re: A tool for making console/text data enrty/display screens in C