Versioning Schema SQL ideas needed

From: Tim Smith <randomdev4+postgres(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Versioning Schema SQL ideas needed
Date: 2015-01-26 22:38:30
Message-ID: CA+HuS5EfWg7+2xt0OrkGGfkiebGgm42NbESWUrbHeU60uGNvYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I've spent too long staring at code today and am facing a bit of a
block when trying to figure out how to best implement the following.

I'm basically looking at tracking versions of some configuration items
saved in a database table. My thinking of the table is something
along the following :

create table templates(
template_id int not null primary key,
template_groupid int not null,
template_version int not null
template_text text not null);

My thinking on the above is :
- template_id is a unique ID for that version
- template_groupid identifies the set the template belongs to
- version is the version

Would I need to resort to using a CTE or subquery to make this sort of
thing work ? I can't seem to make it work with group by since group
by expects aggregation. Surely I don't need to normalise it into a
couple of tables ?

Sorry if its a silly question !

Tim

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Uckun 2015-01-26 22:59:24 Re: Postgres seems to use indexes in the wrong order
Previous Message Tim Uckun 2015-01-26 22:37:38 Re: Postgres seems to use indexes in the wrong order