Subject Re: [firebird-support] GUID/Random number generation?
Author Dean Harding
randallsell wrote:
> Hi,
>
> I have a requirement to create a unique 7 character string (numbers
> and letters). In the file-based implementation, we simply extracted
> the first 7 characters of a GUID. But I see no way to obtain a GUID in
> PSQL. Surely there is a RANDOM function? But didn't find a reference
> to such a beast in Helen's Bible.
>
> BTW- I can't used a Generator because these values are not internal.
>
> So, is there a free library I can obtain to either generate a GUID or
> a random value?

Well, certainly the first 7 characters of a GUID are not going to be
unique, either!!

When you say the value are not "internal" do you mean that some of the
values are generated in the database, and so are generated outside the
database?

That would be fairly easy to solve with a generator, though: simply
generate odd numbers inside the database, and even numbers outside the
database. You can do that with the generator by using an "increment" of 2.

Dean.