postgresql_16:9.7.1.1.2 Options
PostgreSQL 16 > Appendixes > Additional Supplied Programs > Client Applications > oid2name > Options
oid2name accepts the following command-line arguments: -f *filenode* --filenode=*filenode* show info for table with filenode *filenode*. -i --indexes include indexes and sequences in the listing. -o *oid* --oid=*oid* show info for table with OID *oid*. -q --quiet omit headers (useful for scripting). -s --tablespaces show tablespace OIDs. -S --system-objects include system objects (those in information_schema, pg_toast and pg_catalog schemas). -t *tablename_pattern* --table=*tablename_pattern* show info for table(s) matching *tablename_pattern*. -V --version Print the oid2name version and exit. -x --extended display more information about each object shown: tablespace name, schema name, and OID. -? --help Show help about oid2name command line arguments, and exit.
oid2name also accepts the following command-line arguments for connection parameters: -d *database* --dbname=*database* database to connect to. -h *host* --host=*host* database server's host. -H *host* database server's host. Use of this parameter is *deprecated* as of PostgreSQL 12. -p *port* --port=*port* database server's port. -U *username* --username=*username* user name to connect as.
To display specific tables, select which tables to show by using -o, -f and/or -t. -o takes an OID, -f takes a filenode, and -t takes a table name (actually, it's a LIKE pattern, so you can use things like foo%). You can use as many of these options as you like, and the listing will include all objects matched by any of the options. But note that these options can only show objects in the database given by -d.
If you don't give any of -o, -f or -t, but do give -d, it will list all tables in the database named by -d. In this mode, the -S and -i options control what gets listed.
If you don't give -d either, it will show a listing of database OIDs. Alternatively you can give -s to get a tablespace listing.