score:0
You can, as a_horse_with_no_name notes, use the database system identifier. However:
The sysid does not change when you clone a database via
pg_basebackup
, SAN snapshots, etc. The Timeline ID may increment, but doesn't always, depending on method used for copying.The sysid does change if you dump and reload a database to a new instance, even though the database contents are the same.
Many PostgreSQL read/write master instances may have the same sysid if they're all cloned from a common pre-configured postgres in some container template or similar.
It's trivial to regenerate the sysid, or set it to whatever you want it to be.
The sysid is not preserved by
pg_upgrade
so personally, I do not recommend using the sysid. If I had to do disaster recovery and restore a dump into a newly initdb
'd database and your software locked me out, I'd be finding a new vendor and a lawyer.
It doesn't help that it's not currently accessible via SQL, only by using pg_controldata
.
Definitely do not use the version string. It'll be the same for any set of deployments from the same set of packages, distributed binaries, or whatever.
There isn't really anything like what you want in PostgreSQL, and I'm not sure there can be because of the things that people routinely do. Cloning DBs, snapshots and restores, copying a DB for a QA/staging instance, etc, etc.
My personal advice: don't do this. I've had to break systems like this in business emergencies when the license system threatens business continuity. (It's rarely hard). I strongly advocate against tools with active license enforcement when I'm involved in purchasing. Dongles are even worse. Pay attention to the fact that even Microsoft uses "soft" license enforcement, where it helps you track compliance and warns you, but doesn't try to break the system if it thinks you're not in compliance. This is what the legal system is for.
Oh, if you really feel you must do this, Microsoft Windows systems have a SID. But your customers will hate you if they have to reinstall the OS.
Similarly, there's the hardware TPM. But they'll hate you even more if they restore an OS backup image to new hardware and the DB refuses to start.
More questions
- Get ID for Postgres Server Installation
- Jasper server community edition installation issues for Postgres
- unable to connect to server for Postgres
- is there a way to get postgres show actual i/o for query
- EDB Postgres server from local host Apache, Server is up and running The default Apache context is www in the Apache installation
- Can't connect from azure resource to Azure database for postgres server
- Use SQLite for Django locally and Postgres on server
- How to use Parameterized query using TypeORM for postgres database and nodejs as the application's back-end server
- How to get average values for time intervals in Postgres
- Postgres get first and last version for individual vendor
- How to get server OS local time in all Postgres versions
- How to get an element by id in a LIST partitioned table on postgres without scanning all tables for the index?
- Get Average for a Date Range Relative to Each Row Using Postgres Window Functions
- Java app in docker: Failed to get driver instance for postgres
- How can I get data from a certain column of a .tsv file into a Postgres array column? Is regex the right tool, or should I look for another approach?
- With doctrine I am not able to get the right sequence name for Postgres
- Why am I getting a could not connect to server error for postgres in Mac OS Lion?
- postgres password error : Please enter the password for the user 'postgres' to connect the server - "PostgreSQL 13"
- Did anyone get pgloader to work for migration from Mysql to Postgres
- How can I get the process id for the same query I have executed on postgres
- Get the first and the last time for every day in postgres
- Postgres query to get last date value for period along with sum for period?
- Unable to log in to postgres on windows after fresh installation - "psql: FATAL: password authentication failed for user "postgres""
- How can I get the INSERTED and UPDATED rows for an UPSERT operation in postgres
- Rails looking for MySQL instead of Postgres after MYSql installation
- How can I get the max char_length for all character varying columns in postgres
- How can I get a list of allowed values for a postgres constraint check from php
- Hook for Postgres server to run code when a DB connection is closed or lost?
- How to get sanitized postgres SQL string in python for later use?
- Get most common day of week for column in Postgres table
More questions with similar tag
- libpq call gives "UTF8": 0xe6 0x62 0x40
- Delete from association table that have primary composite key
- PostgreSQL: Function with multiple date parameter
- Usage of aliases in OVER() clause
- Building a Chainlink node for a new blockchain, connection failure with error near "INCLUDE error running migration"
- Syntax error on PostgreSQL create table without double quotes
- PostgreSQL JOIN with array type with array elements
- Reuse Cursor Declaration in postgres
- How to update table from postgresql database after specefic time interval using AJAX and PhP
- rails get record that is not exist on right join
- Creating a PersistentVolume on Okteto Cloud
- How to Group by and concatenate arrays in PostgreSQL
- MysqlWorkbench PostgreSQL Driver
- BeautifulSoup responses - Beautiful Soup is not an HTTP client
- pg_dump ignoring table sequence?
- Put postgres function files in classpath and execute on Spring Boot start up event, it is a good idea?
- How to convert Postgres plpgsql user-defined function to LANGUAGE SQL user-defined function?
- How do I solve «panic: sql: unknown driver "postgres" (forgotten import?)»?
- NodeJS + CloudSQL Postgres - Connection terminates randomly
- Creating indexes on big tables - postgresql 9.6
- Complex SQL Joins
- For an SQLAlchemy query, how to combine ilike search operator with in_ operator?
- PostgreSQL PSQL SELECT into a variable
- Provide sync between PostgreSQL and NoSQL database
- How to recover South from flushing db
- How to find a code that try to get access to nonexistent database column?
- Moving from HDF5 to PostgreSQL
- Why is PostgreSQL Harder to Manage/Maintain then other Databases
- Basic SQL Select in Postgresql fails
- postgres error : invalid page header in block yyy, but fine while run with 'order by'