[Top][All Lists]

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

Re: [bug-recutils] Counters and Unique IDs

From: Jose E. Marchesi
Subject: Re: [bug-recutils] Counters and Unique IDs
Date: Mon, 21 Oct 2013 19:15:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Hi John.
             Sections "Counters" and "Unique Identifiers"
              I'm not sure what should go here.  This again seems to be things 
             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.

    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 here.
       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

reply via email to

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