Versioning Schema SQL ideas needed - Mailing list pgsql-general

From Tim Smith
Subject Versioning Schema SQL ideas needed
Date
Msg-id CA+HuS5EfWg7+2xt0OrkGGfkiebGgm42NbESWUrbHeU60uGNvYQ@mail.gmail.com
Whole thread Raw
Responses Re: Versioning Schema SQL ideas needed  (Maciek Sakrejda <maciek@heroku.com>)
Re: Versioning Schema SQL ideas needed  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List 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


pgsql-general by date:

Previous
From: Tim Uckun
Date:
Subject: Re: Postgres seems to use indexes in the wrong order
Next
From: Tim Uckun
Date:
Subject: Re: Postgres seems to use indexes in the wrong order