Re: programmatic way to fetch latest release for a given major.minor version

From: Listmail <lists(at)peufeu(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: programmatic way to fetch latest release for a given major.minor version
Date: 2007-04-10 11:44:43
Message-ID: op.tqkf8tm5zcizji@apollo13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-www


>> Yeah yeah, but terminology aside, having 2 or three digits in each
>> attribute is just wrong!
>
> Terminology aside, why? The unit is "8.1" not "8" and "1". It makes no
> sense to say you're on version 8, in the given context, so why should the
> XML data pretend there is?
>
> //Magnus

Just pretend that :

- version = a tuple of integers (a, b, c, ...)
- major = (a, b)
- minor = (c, ...)

Besides, that is sortable (unlike strings where 15 < 2) :

latest minor for major :
major, max(minor) where major = what you want

<pgversion><major><int value="8" /><int value="2" /></major><minor><int
value="3" /></minor></pgversion>

from BeautifulSoup import BeautifulSoup as Soup
s = Soup("""<pgversion><major><int value="8" /><int value="2"
/></major><minor><int value="3" /></minor></pgversion>""" )

>>> v = s.find('pgversion')
>>> [int(x['value']) for x in v.find('major') ]
[8, 2]
>>> [int(x['value']) for x in v.find('minor') ]
[3]

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ashish Karalkar 2007-04-10 12:01:30 Kill session in PostgreSQL
Previous Message Dave Page 2007-04-10 11:35:38 Re: [GENERAL] programmatic way to fetch latest release for a given major.minor version

Browse pgsql-www by date

  From Date Subject
Next Message Magnus Hagander 2007-04-10 12:27:08 Re: [GENERAL] programmatic way to fetch latest release for a given major.minor version
Previous Message Dave Page 2007-04-10 11:35:38 Re: [GENERAL] programmatic way to fetch latest release for a given major.minor version