From: | Adriaan Joubert <a(dot)joubert(at)albourne(dot)com> |
---|---|
To: | Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> |
Cc: | Postgresql <pgsql-hackers(at)postgreSQL(dot)org> |
Subject: | Re: [HACKERS] Re: [GENERAL] Update of bitmask type |
Date: | 1999-09-23 16:20:49 |
Message-ID: | 37EA5361.59EC106D@albourne.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Thomas asked how I was going to implement bitstring comparisons.
>
> How do you handle the length and ordering issues? Is x'01' greater
> than x'1' since it is longer? And if you have a 16-bit bit column, how
> does it look internally if you assign x'01' rather than x'0001'?
I had a look in my freshly down-loaded draft standard. On page 336 it
says:
7) The comparison of two bit string values, X and Y, is
determined
by comparison of their bits with the same ordinal position.
If Xi and Yi are the values of the i-th bits of X and Y,
respectively, and if LX is the length in bits of X and LY is
the length in bits of Y, then:
a) X is equal to Y if and only if X = LY and Xi = Yi for all
i.
? I presume this should be 'LX=LY' ?? Anyway, this means that b'01' <>
b'0010'.
b) X is less than Y if and only if:
i) LX < LY and Xi = Yi for all i less than or equal to LX;
or
ii) Xi = Yi for all i < n and Xn = 0 and Yn = 1 for some n
less
than or equal to the minimum of LX and LY.
b) seems to imply, rather bizarrely in my opinion, that
B'001100' < B'10'
as the second bit in B'10' is 1 and in B'001100' it is 0.
Surely I must be reading this wrong?
On the other hand, this would be a type of lexicographical ordering,
so
perhaps it is not so dumb. Comments?
Adriaan
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1999-09-23 17:25:07 | Re: [GENERAL] Is it possible run pgsql in Windows 95 ? |
Previous Message | Sebestyen Zoltan | 1999-09-23 16:02:49 | 6.4.2->6.5.2 migration problem.. |
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Zeugswetter | 1999-09-23 16:47:55 | Re: [HACKERS] [GENERAL] when are indexes used? |
Previous Message | InfraRED/Veres Tibor | 1999-09-23 15:45:01 | Re: [HACKERS] [GENERAL] when are indexes used? |