Re: [GENEAL] dynamically changing table - Mailing list pgsql-general

From A B
Subject Re: [GENEAL] dynamically changing table
Date
Msg-id dbbf25900903301017s6b9dfab1ufeebce4674713782@mail.gmail.com
Whole thread Raw
In response to Re: [GENEAL] dynamically changing table  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
> Well, not as such. Except that deleting a column doesn't really delete
> it, it hides it, so it never really goes away. So the number of
> "columns" in your table will only go up and eventually you're going to
> reach the point (around 1600 IIRC, probably earlier) where it will
> simply stop working.

Oh, that would be a not very plesant surprise.

> If this is just for development where the actual space/columns used is
> just temporary, your trick might work. Otherwise I'd suggest
> normalising so the columns to become rows in another table. But you're
> going to have to be more specific as to what you're trying to do if you
> want proper answers.

Well, I want to store information about certain objects. Some columns
will be fixed from the start, other columns will be added or removed
(like when someone comes up with a brilliant idea of adding new
information about the object, or removing something that is not
needed)
It's a little hard to specify what operations will be performed on the
data, but mostly it will be "fetch all data for object number X", or
"increase integer field nr 4 by 1 for object number X".
And then I'll also have the operations: "add a new field with default
value 0" and "remove integer field number 2"


The fixed columns could be placed in a special table, as suggested above.

> Or perhaps an array of integers?
That sounds to be a better way. I'll start reading about arrays. I
have not used them earlier so I wasn't thinking about them.
How would you handle fields of other datatype than integers? Have an
array for timestamps, one for texts, one for varchar(50), one for
floatingpoint numbers, etc.?

pgsql-general by date:

Previous
From: Emanuel Calvo Franco
Date:
Subject: Re: running two clusters on one machine
Next
From: David Fetter
Date:
Subject: Re: [GENEAL] dynamically changing table