Next: , Up: Introspection   [Contents][Index]


14.1 Standard Introspection

The PostgreSQL documentation says:

The information schema consists of a set of views that contain information about the objects defined in the current database. The information schema is defined in the SQL standard and can therefore be expected to be portable and remain stable—unlike the system catalogs, which are specific to PostgreSQL and are modelled after implementation concerns. The information schema views do not, however, contain information about PostgreSQL-specific features; to inquire about those you need to query the system catalogs or other PostgreSQL-specific views.

This section describes Guile-PG support for querying the information schema. For PostgreSQL-specific features, See Funky Introspection.

Procedure: information-schema-names [full?]

Return a list of information schema view names (each a string). Optional arg full?, non-#f means to prefix each name with ‘information_schema.’ (note trailing dot).

Procedure: information-schema-coldefs name

Return the column definitions for view name.

To see everything about everything, for example, you can try:

(define (spew name)
  (pg-print (pg-exec CONN (simple-format
                           #f "SELECT * FROM ~A;"
                           name))))

(for-each spew (information-schema-names #t))