Re: type "xxxxxxx" does not exist

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Micky Hulse <mickyhulse(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: type "xxxxxxx" does not exist
Date: 2017-05-19 20:31:13
Message-ID: CAKFQuwbfvjfwAzekb2TuBuYepmN9Xo4AbAuFTw5JGCEuvOjcKw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, May 19, 2017 at 1:06 PM, Micky Hulse <mickyhulse(at)gmail(dot)com> wrote:

​Short answer here is that whomever is calling that function needs to
ensure that their search_path is setup so that the type can be found
somewhere in it. Your desire for obscurity means you are pretty much on
the hook for figuring out the right command to do so.

See https://www.postgresql.org/docs/current/static/config-setting.html for
help on various ways to go about making the actual change.

> I hope this is the right list for me to ask questions about psql.
> Please let me know if I am in the wrong place. :)
>

​Right place

>
> When listing the functions, I see that functionName() does exist in
> the database.
>

​As the error is coming from within the function it indeed must exist and
be visible to you.

>
> The type also exists (I think):
>
> # select exists (select 1 from pg_type where typname = 'xxx_xxx_xxxxx');
> exists
> --------
> t
> (1 row)
>

​Existence and visability​ are two different things. It indeed exists. It
is apparently not visible to the user when at the time the function is
invoked - and the function doesn't explicitly say where to find it.

>
> Note that the role that owns the 'type' is not the same user that is
> calling the "functionName()" from the psql prompt.

Doesn't matter. Types in PostgreSQL are not restricted since they never
themselves contain any data. As long as you can find a custom type you can
use it.

> ALTER TYPE xxx_xxx_xxxxx OWNER TO otherusername;
>
>
​All objects have owners.​

​David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Micky Hulse 2017-05-19 20:57:18 Re: type "xxxxxxx" does not exist
Previous Message Paul Jungwirth 2017-05-19 20:25:59 Re: type "xxxxxxx" does not exist