Re: Killing OIDs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Killing OIDs
Дата
Msg-id 12568.1234378774@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Killing OIDs  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Steve Crawford
Дата:
Сообщение: Re: Killing OIDs
Следующее
От: Kedar
Дата:
Сообщение: Re: COPY command question