Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

If you connect pgadminIII to a PostgreSQL 9.x server, you'll find two catalogs exposed in the user interface: ANSI (information schema), and PostgreSQL (pg_catalog).

I'm looking for documentation that describes the mapping between

  • database objects and the system tables
  • the system tables and the information_schema views

For example, I'd like to be able to take a sequence name from a database, and be able to tell quickly where the sequence itself, the sequence's name, and the sequence's ACL (from GRANT and REVOKE statements) would be found in both the system tables and in the information_schema views.

Is that documented anywhere? I've been through PostgreSQL's online documentation, and I've found details of both the ANSI and PostgreSQL catalogs, but I haven't found documentation of the mappings.


It looks like the information is probably in the source file information_schema.sql, but that file doesn't seem to be in the online source code. (See, for example, initdb.c at http://doxygen.postgresql.org/.)

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The system tables are the implementation of database objects. So if you, say, call a function foo(), the DBMS looks in pg_proc to see if there is a function foo and what the arguments and the source code and so on are. The layout and arrangement of the system catalogs are merely the way the implementors of various features over time made them. You already pointed out the documentation of the catalogs. In many cases, there is a simple mapping, say, between a function and pg_proc. But in other cases, such as for an index, it's a bit more complicated. You will have to dig that information out of the documentation or perhaps the many examples of system catalog queries flying around.

The information schema is specified by the SQL standard. The principle there is, if you enter these DDL commands, then a query of the information schema should give these results. In many cases, there is again a simple mapping between objects and information schema views, but it's not straightforward in all cases. So maintaining a separate documentation of the mapping of this information would be cumbersome and probably useless. The principle is DDL in, information schema out, not what happens in the PostgreSQL system catalogs.

Ultimately, if you want to know whether a sequence would be found in a catalog table or an information schema view, you need to query these tables. The reality is too complicated for this to be simpler. (I think. Send a patch if you have a better idea.)

share|improve this answer

Since most of the information schema is in the form of views against pg_catalog you can get a big chunk of it using psql:

psql -U postgres -c "\d information_schema.*" > information_schema.sql
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.