select * from information_schema.schemata but even though it has a column catalog_name you will never see a value that id different from the current database in there. Postgres does not support cross-database queries
user330315
–
user330315
2016-04-05 07:34:43 +00:00
CommentedApr 5, 2016 at 7:34
and how to do this? I dev application in Java and have to get all schemas from specified database :c
Just run that statement, it will return all schemas.
user330315
–
user330315
2016-04-05 07:42:14 +00:00
CommentedApr 5, 2016 at 7:42
Maybe you can achieve what you need with a combination of shell scripting and psql command. Can you expand on your requirements, type of output, and the consumer of the data?
SELECT schema_name
FROM information_schema.schemata
WHERE schema_name NOT LIKE 'pg%'
AND schema_name NOT LIKE 'information_schema'
AND catalog_name LIKE 'YOUR_DATABASE_NAME'
select * from information_schema.schematabut even though it has a columncatalog_nameyou will never see a value that id different from the current database in there. Postgres does not support cross-database queries