Dynamically created tables [WAS Re: "Relation x does not exist" ...

From: Gaurav Priyolkar <pgaurav(at)goatelecom(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Dynamically created tables [WAS Re: "Relation x does not exist" ...
Date: 2001-10-16 18:02:49
Message-ID: 20011016233249.F926@goatelecom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 16, 2001 at 01:22:45AM -0700, Randal L. Schwartz wrote:
> >>>>> "Gaurav" == Gaurav Priyolkar <gaurav_lists(at)yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Benny Marin 2001-10-16 18:31:27 BLOB
Previous Message will trillich 2001-10-16 17:55:50 binding tcp connections to certain addresses