Get table OID
Hi, ALL,
Is it possible to get the table ID (or OID) from information_schema somewhere?
Thank you.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Thu, Jul 13, 2017 at 11:06 AM, Igor Korot <ikorot01@gmail.com> wrote:
Hi, Melvin,
On Thu, Jul 13, 2017 at 10:42 AM, Melvin Davidson <melvin6925@gmail.com>
wrote:On Thu, Jul 13, 2017 at 10:36 AM, Igor Korot <ikorot01@gmail.com> wrote:
Hi, ALL,
Is it possible to get the table ID (or OID) from information_schema
somewhere?Thank you.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-generalIt 's in pg_class!
https://www.postgresql.org/docs/9.4/static/catalog-pg-class.html
But pg_class is in postgres database.
Can I do something like this:SELECT oid FROM postgres.pg_class WHERE relname = <my_table_name>;
Or I will have to connect to postgres database?
Thank you.
IOW:
SELECT relname, oid FROM pg_class WHERE relkind = 'r' ORDER BY 1;
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
*Igor,*
*You do not need to specify "postgres" schema (postgres.pg_class). That is
wrong anyway.*
*FYI, the correct schema is pg_catalog, but All postgres CATALOGS are
always available regardless of which database you are connected to.*
*and it is in the default search path, so you do not have to specify it.*
*Just do:SELECT oid FROM pg_class WHERE relname = <my_table_name>;*
*It will work just fine! I highly encourage you to RTFM.*
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
Import Notes
Reply to msg id not found: CA+FnnTwWXNA5iNAhAKLb9AEWsMU7pc6FDcDX0ETCu40nji+HqA@mail.gmail.com