Re: Search system catalog for mystery type

From: "Carlo Stonebanks" <stonec(dot)register(at)sympatico(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Search system catalog for mystery type
Date: 2009-11-06 16:09:23
Message-ID: hd1hmf$16f7$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ok, it appears that relations and types automatically get a copy made of
some object with the same name, prefixed with a leading underscore. Now,
that was a dangerous choice! By convention, we all know that the safest
characters to use across DB platforms are lowercase chars and underscores.

In the past, I had been able to prefix tables, indexes, etc with
underscores. It is a tactic we use when I am "soft deleting" objects, or
installing new versions over old. The number of underscrores indicates how
many versions old it is. This convention (rather than the classic
"my_table_old") makes the tables float to the top of schema listings,
attracting attention during Db maintenance.

This was really common with us with PG for years, and now it errors out -
what happened, and when?

Carlo

"Alvaro Herrera" <alvherre(at)commandprompt(dot)com> wrote in message
news:20091104205734(dot)GJ3531(at)alvh(dot)no-ip(dot)org(dot)(dot)(dot)
> Carlo Stonebanks wrote:
>> When I try the following command:
>> ALTER TABLE mdx_core.audit_impt RENAME TO _audit_impt;
>>
>> I get the error message:
>>
>> ERROR: type "_audit_impt" already exists
>> SQL state: 42710
>
> Probably the easiest way around this is to use two underscores instead
> of one:
>
> ALTER TABLE mdx_core.audit_impt RENAME TO __audit_impt;
>
> Or any other char for that matter -- you picked the only one that would
> cause a problem. Even a space should be fine:
>
> ALTER TABLE mdx_core.audit_impt RENAME TO " audit_impt";
>
> (Not sure I can recommend this though)
>
> --
> Alvaro Herrera
> http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Raimon Fernandez 2009-11-06 16:25:58 Re: MD5 Authentication
Previous Message Magnus Hagander 2009-11-06 15:32:00 Re: PostgreSQL for 64 Bit Windows Version