Is there any unique identifier for PostgreSQL? How can the master identify its slave unqiuely? Is there any way to have more than one PostgreSQL slave servers in the same system.

If yes, how come a master detect each server as different slaves from the below query

select * from pg_stat_replication;


will give one row for each slave which are connected to it, with PID, IP-address/client_address, client_port, etc..

If two servers are running in the same machine gives the same IP-address so it is not a unique identifier.

If slave got restarted then both client_port and PID will change so these are also cant be a unique identifier.

So, what is the unique identifier used by Postgres master to identify each slave server uniquely? Or how it is finding its slave servers differently?
The master does not "find" the replicas.  The replicas find the master.

The master identifies the replicas by either their slot_name, or their application_name, or not at all, depending on the context.

What are you trying to do?