Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgresql: for a given table name what is schema name?

I have a table name student and like 35 schemas in my DB. how can i get in which schema the table student exists? (there might be more than one in different schemas).

I've tried through pg_class but I don't know how to get schema name from there.

like image 503
John Avatar asked Oct 21 '25 11:10

John


1 Answers

You could query it from information_schema.tables:

SELECT table_catalog, table_schema 
FROM   information_schema.tables 
WHERE  table_name = 'student'
like image 64
Mureinik Avatar answered Oct 23 '25 01:10

Mureinik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!