Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for Greenplum®
  • Getting started
    • All guides
    • Connecting to a database
    • Connecting to an external file server (gpfdist)
      • Managing extensions
      • pgcrypto
      • uuid-cb
      • Yezzey
    • Auxiliary utilities
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Installing the uuid-cb extension in a Greenplum® cluster
  • Usage example
  1. Step-by-step guides
  2. Greenplum® extensions
  3. uuid-cb

Using uuid-cb in Managed Service for Greenplum®

Written by
Yandex Cloud
Updated at December 11, 2023
  • Installing the uuid-cb extension in a Greenplum® cluster
  • Usage example

The uuid-cb extension exports functions for generating and validating unique IDs in compliance with the Russian Central Bank requirements:

  • uuid_cb_generate(): Generates a text value that is a unique ID in the format required by the Russian Central Bank.
  • uuid_cb_valid(text): Returns a boolean value that indicates if a text argument is a unique ID in the format required by the Russian Central Bank.

Installing the uuid-cb extension in a Greenplum® clusterInstalling the uuid-cb extension in a Greenplum® cluster

  1. Connect to the database as the owner or a user with the CREATE permission and run the command:

    CREATE EXTENSION "uuid-cb";
    
  2. Make sure that the extension is installed:

    SELECT extname FROM pg_extension;
    

Usage exampleUsage example

  1. Create a table with unique IDs and data such as:

    CREATE TABLE uid_tbl (
        uid TEXT NOT NULL DEFAULT uuid_cb_generate() CHECK (uuid_cb_valid(uid) = true),
        data INTEGER NOT NULL,
        PRIMARY KEY (uid)
        )
    DISTRIBUTED BY(uid);
    

    The unique IDs in the format required by the Russian Central Bank will be generated in the uid column as default values. A check doesn't allow inserting values that are not unique IDs in the format required by the Russian Central Bank.

  2. Insert the test data into the data column:

    INSERT INTO uid_tbl (data)
    SELECT d FROM generate_series(1, 10) d;
    

    For each command run, pseudorandom ID values are generated.

  3. Check the generated data:

    SELECT * FROM uid_tbl;
    

    Result:

                      uid                   | data 
    ----------------------------------------+------
     4b68f587-6739-11ed-80d4-1b1dc5b7125e-1 |    8
     4b68f589-6739-11ed-80d4-1b1dc5b7125e-1 |   10
     4b68f581-6739-11ed-80d4-1b1dc5b7125e-1 |    2
     4b68f583-6739-11ed-80d4-1b1dc5b7125e-1 |    4
     4b68f585-6739-11ed-80d4-1b1dc5b7125e-1 |    6
     4b68f588-6739-11ed-80d4-1b1dc5b7125e-9 |    9
     4b68f580-6739-11ed-80d4-1b1dc5b7125e-9 |    1
     4b68f582-6739-11ed-80d4-1b1dc5b7125e-9 |    3
     4b68f584-6739-11ed-80d4-1b1dc5b7125e-9 |    5
     4b68f586-6739-11ed-80d4-1b1dc5b7125e-9 |    7
    (10 rows)
    

Greenplum® and Greenplum Database® are registered trademarks or trademarks of VMware, Inc. in the United States and/or other countries.

Was the article helpful?

Previous
pgcrypto
Next
Yezzey
© 2025 Direct Cursus Technology L.L.C.