[Top][All Lists]

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

Re: [bug-recutils] Counters and Unique IDs

From: John Darrington
Subject: Re: [bug-recutils] Counters and Unique IDs
Date: Mon, 21 Oct 2013 19:24:30 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Oct 21, 2013 at 07:15:33PM +0200, Jose E. Marchesi wrote:
     Hi John.
                  Sections "Counters" and "Unique Identifiers"
                   I'm not sure what should go here.  This again seems to be 
things not
                  yet implemented. Delete?
              That is about %auto, which can be used to implement automatically
              incremented counters and also unique identifiers in databases.
         I'm confused here.
         1.   What is the difference between a "counter" and a 
         "unique identidier"?  I would have guessed that a counter is merely a
         special case of a unique id.  A counter is obviously integer, whereas
         (in my way of thinking) a unique id could be a string.  However, in
         recutils %auto may only be used with integers and dates and a few other
         very special types.
     Hm yes.  Probably "counter" is not the right word for what I meant:
     consecutive unique integer identifiers.
         2.  How exactly to set up a counter in recutils is also not clear.
         The naive answer would be thus:
         %auto: counter
         %type: counter int
         This kindof works, but for a few problems:
         a) If there already happens to be two records with 
            counter: 4  recfix will neither detect nor fix that.
         b) This could be overcome by adding the field %key: counter however,
            there might already be a primary key for this record set in which
            case that would not be allowed.
     That behavior is expected, since recfix is not (and must not be) aware
     of how a value in a field was created/generated.

Would it not be possible to add a special field (dunno what to call it) 

%foo: myuniqueid

which would cause recfix to error if there were two (or more) myuniqueid fields 
with the same value?
         3. Unique IDS are also difficult in the following situation:  Sometimes
            I want a field which may or may not exist.  However IF it exists
            then I want it to be unique.  Nieither %auto nor %key will help 
            Perhaps it could be done with %constraint, but I don't see how.
     What situations are you thinking about?  I don't see how this would be

Curiously enough, I came across this one at work last week.  We have a database
of devices.  Some of the devices have a capability to be used with a certain
driver, some do not.  The driver needs to be able to interogate the device for
its ID.  Thus, the ID does not exist for all devices, but no two devices may
share the same ID.


PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]