Search Postgresql Archives

need elegant way to store and query tables with variable headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi:

 

Longshot, but here goes....

 

Someone is asking me for a way to architect a model which will store basic table data (columns with names and rows), but the number and name of the columns are both variables.  I'll call these "data-tables" here.   

 

Example, Store this "data-table"....

 

'col1'     'col2'     'col3'     'val'

0             0             0             'a'

0             0             1             'b'

0             1             0             'c'

 

Then store this one...

 

'c1'         'c2'         'c3'         'c4'         'val'

0             0             0             0             'w'

0             0             0             1             'x'

0             0             1             0             'y'

0             0             1             1             'z

 

Order is important because they may want to reconstruct the table as is (e.g. 'w' comes before 'x' comes before 'y' ...)

 

Assume you can capture this info inside the context of a script (perl or something) which you would then need to store in a DB.  And assume you have a "data_id" in hand for each of these "data-tables" that could be used to link them to a parent table somewhere else in the DB. Finally, assume you'll never have to query outside the context of one of these data-tables.  IOW, you'll never have to come up with all "data_id" where "c3 = 1".  But you may need to update 'val' where data_id=100 and c1=0 and c2=1 and, ... etc.. .  And you may need to select on the data-table as if it was a real sql table.

 

Any ideas?

 

Thanks !

 

 

 

 

 

 

 

 

 

 

 

 

 


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux