crsql_site_id
Each databases has a unique "site id" to identify itself to other databases. To get the site id of the current database, use crsql_site_id
.
site_id
is a 16 byte uuid. At the time of this writing it is a v4 uuid but is being moved to a v7 uuid (opens in a new tab) for better index performance for those use cases that need to index many sites (e.g., IOT).
In either case, site_id
should be treated as an opaque value that only serves to identify a database.
Usage
SELECT crsql_site_id();
For a hex encoded result:
SELECT quote(crsql_site_id());