From: | "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | need elegant way to store and query tables with variable headers |
Date: | 2013-10-08 18:27:24 |
Message-ID: | 0AD01C53605506449BA127FB8B99E5E170D12962@FMSMSX114.amr.corp.intel.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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 !
From | Date | Subject | |
---|---|---|---|
Next Message | David Johnston | 2013-10-08 18:47:30 | Re: need elegant way to store and query tables with variable headers |
Previous Message | Bill Moran | 2013-10-08 18:01:18 | Looking for some advise on training materials |