UUID Field Type or Formula

Thanks @rishi :confetti_ball:

No, unfortunately, UUID wasn’t added to this release. The feature was accepted, which means we are going to work on it, but we don’t know yet when we will start. I’ll keep you posted :ok_hand:

Thanks. I’ll follow up later on this.

For the record: this feature request has been accepted and can be followed in Gitlab issue #1463

Hi!
I’m very attentive to the issue about the creation of a uuid field type :slight_smile: Do you have an idea on the release on which it will be added?
Is there a mean to simulate a uuid with the formula field? I tried some formulas like uuid = row_id() * p + b modulo[n] with n ~ 10⁹ and p and n prime but this is not very convincing.
Thanks,
asan

2 Likes

Hello @asan, unfortunately, we cannot provide you with any estimates. However, all issues on GitLab can now be filtered by weight, which will give you a general understanding of the priority of this feature among all the issues on our GitLab.

Important to mention that weight depends on numerous factors (which we will explain in detail soon), and one of these factors is the number of requests we receive from the community. So it’s great that you and others are voting in this thread and on GitLab. We keep track of all the requests. :raised_hands:

Is there a mean to simulate a uuid with the formula field? I tried some formulas like uuid = row_id() * p + b modulo[n] with n ~ 10⁹ and p and n prime but this is not very convincing.

Let me check this; perhaps my teammates have some ideas.

Hey @asan, getting back to you on this:

Is there a mean to simulate a uuid with the formula field? I tried some formulas like uuid = row_id() * p + b modulo[n] with n ~ 10⁹ and p and n prime but this is not very convincing.

I asked the team, and we do not think there is a way to simulate a UUID value with the formula field at this time. I will keep you posted if there are any updates regarding this issue: UUID Field Type or Formula (#1463) · Issues · Baserow / baserow · GitLab. :raised_hands:

Hi,
Thanks for your answers :slight_smile:
I used the n8n uuid node to generate the uuids and it works perfectly !
Asan

1 Like

Any news regarding the requested features?

Hey @glarrain-cdd, no news yet. I’ll publish the updates as soon as we have them. :raised_hands:

1 Like

Baserow badly needs this asap…

Actually, @bram picked up this issue a few days ago: UUID Field Type or Formula (#1463) · Issues · Baserow / baserow · GitLab, and it’s already ready. :slightly_smiling_face:

The UUID field type will be released in Baserow 1.22.

3 Likes

I have seen it! Many thanks for your work :slight_smile:

@olgatrykush This is great news.

I’ve gone quickly over the PR’s code by @bram, and I’m curious why the random UUID (v4) value generation is performed with a custom DB formula instead of just relying on the formula already included in Postgres (gen_random_uuid).

The custom formula is pretty complex and there isn’t any information in the code about where it was obtained from, etc

uuid_in(overlay(overlay(md5(random()::text || ‘:’ || random()::text) placing ‘4’ from 13) placing to_hex(floor(random()*(11-8+1) + 8)::int)::text from 17)::cstring)

Hey @glarrain-cdd, unfortunately, the gen_random_uuid function is only available from PG 13, and Baserow supports PG 11 and up. I’ve got the uuid function from this Stackoverflow question: postgresql - Generating a UUID in Postgres for Insert statement? - Stack Overflow. I’ll add a comment in the code to there.

2 Likes

Thanks for your response.

A couple of comments:

  • uuid_generate_v4 is supported in PG 11, in theuuid-ossp official extension
  • PG 11 end of life (end of official support) is 9 Nov 2023 (Postgres policy is to do this 5 years after the initial release (2018 in the case of PG 11)

Hi @glarrain-cdd, I realize that there are extensions that can help with generating UUIDs, but unfortunately, we can’t depend on PostgreSQL extensions. This is because we allow users to self-host, and we never know whether they can access to installing extensions.

We’re soon going to make PG 12 as minimum requirement for Baserow. Unfortunately, the native uuid functions were included in PG 13.

A minor comment that might be useful for others interested in the details, or for future reference:

  • Postgres SQL function random (part of the math functions) returns pseudo-random values, which means those values can not be used for crypto-secure purposes
  • Postgres UUID (v4) SQL functions do return values that have been calculated using crypto-secure tools (true random number generators (RNGs))

Thus, the aforementioned custom formula is supposed to be appropriate for most cases, but it is not entirely equivalent to Postgres UUID (v4) generation SQL functions. For most people, that detail would be insignificant.

Thank you for explaining that @glarrain-cdd. Would you mind sharing more about your use-case for the UUID field so that I have a better understanding of what you need true random values for?

Sure. We have many databases in disparate systems. We refactor and move tables a lot, and for that has been extremely valuable to have a globally unique ID per record.

We’ve been wanting to use baserow in our company for some time, and have been waiting until all our non-functional requirements are fulfilled. The UUID v4 data type (and random value generation on record creation) is one of those.

Version 1.22 is now available and with it this feature. :blush:

5 Likes