Re: Constraint: string length must be 32 chars

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Constraint: string length must be 32 chars
Date: 2010-10-17 00:37:43
Message-ID: 4CBA4557.2030203@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I just read the "anonymously" part, so I take it you have ruled out
recording the given coordinate components directly, in multiple columns
presumably? Otherwise it seems you could then do a) a composite key and
b) queries directly against coordinate values.

Alexander Farber wrote:
> Thank you for your advices.
>
> I actually would like to store GPS coordinates, but anonymously,
> so I was going to save md5(my_secret+IMEI) coming from a mobile...
>
> I have to lookup if uuid is supported there
>
> Regards
> Alex
>
> On Sat, Oct 16, 2010 at 11:08 PM, Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
>> Merlin Moncure wrote:
>>
>>> why don't you use the bytea type, and cut the key size down 50%? You
>>> can always format it going out the door if you want it displayed hex.
>>> Besides being faster, you get to skip the 'is hex' regex.
>>>
>>> create table foo(id bytea check(length(id) = 16));
>>> insert into foo values (decode(md5('a'), 'hex')); -- if not using pgcrypto
>>> insert into foo values (digest('b', 'md5')); -- if using pgcrypto
>>> (preferred)
>>>
>>> select encode(id, 'hex') from foo;
>>>
>> Why not the support uuid type instead. Aren't md5s only as unique as the
>> source? i.e. The same value hashed results in the same md5, no?
>>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2010-10-17 01:28:16 Re: installing from source in Windows
Previous Message Darren Duncan 2010-10-16 22:48:36 Re: Constraint: string length must be 32 chars