pg_tablespace_databases ( tablespace oid ) → setof oidReturns the set of OIDs of databases that have objects stored in the specified tablespace. If this function returns any rows, the tablespace is not empty and cannot be dropped. To identify the specific objects populating the tablespace, you will need to connect to the database(s) identified by
pg_tablespace_databases and query their pg_class catalogs.