Re: Killing OIDs - Mailing list pgsql-general

From Tom Lane
Subject Re: Killing OIDs
Date
Msg-id 12568.1234378774@sss.pgh.pa.us
Whole thread Raw
In response to Re: Killing OIDs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I wrote:
> Sure it will.  I'd be a little worried about whether he shouldn't
> be using quote_identifier and/or schema-qualifying the names, but
> SET WITHOUT OIDS is the right command to be issuing.

BTW, the lazy man's way to deal with both of those issues is to cast
the OID to regclass, ie the best way to handle this is

SELECT
  'ALTER TABLE ' || oid::regclass || ' SET WITHOUT OIDS;'
FROM pg_class WHERE ...

Observe the following example:

regression=# create schema s1 create table "Foo"(f1 int);
CREATE SCHEMA
regression=# select max(oid)::regclass from pg_class;
   max
----------
 s1."Foo"
(1 row)


You can similarly use regprocedure, regoperator, etc to get
safely qualified names for functions, operators etc.

            regards, tom lane

pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Re: Killing OIDs
Next
From: Kedar
Date:
Subject: Re: COPY command question