Re: Killing OIDs

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: jd(at)commandprompt(dot)com, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Killing OIDs
Date: 2009-02-11 18:55:31
Message-ID: 49931F23.8020605@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane wrote:
> ...
> 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.
>
It may not make any difference in this case, but for completeness and
correctness:

SELECT
'ALTER TABLE ' || quote_ident(n.nspname) || '.' ||
quote_ident(c.relname) || ' SET WITHOUT OIDS;'
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_user u ON u.usesysid = c.relowner
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind = 'r'
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid)
AND c.relhasoids
;

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-02-11 18:59:34 Re: Killing OIDs
Previous Message Alvaro Herrera 2009-02-11 18:53:18 Re: Saber cuando se dispara el trigger (After: insert,update,delete)