Re: [HACKERS] Namespace of array of user defined types is confused by the parser in insert?

From: Krzysztof Nienartowicz <krzysztof(dot)nienartowicz(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "Psql_General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [HACKERS] Namespace of array of user defined types is confused by the parser in insert?
Date: 2012-04-24 09:12:56
Message-ID: CABY7=+4snSUFUP42VbuWLafTCPf1x1fStFP_RRCHd1NQ0PKxtg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> pgsql-general probably would be best. -hackers is for discussion of internals and development, not for usage questions.

ok, thank you.

>
> [types have namespaces]
>
>
>> Is there any way of avoid this error different than having a single
>> type defined for all schemas?
>> Any hints appreciated..
>
>
>
> Probably your best bet is to put the types explicitly in the public
> namespace when they are created, instead of relying on the search path that
> happens to be in force at the time:
>
>   create type public.foo as ( ...);

Yes, I did it in the end, but such a solution makes things risky if
the types evolve and the namespaces might hold different schema
versions.
This error occurs when there is no search_path overlap, i.e. roles
have only their own namespace search_path, even without public path
set.

>
>
> Then, assuming that public is in your search path they will be picked up
> properly when used. Alternatively, you can namespace qualify them when used:
>
>   create type public.bar as (f1 public.foo[], ...);

These types are qualified when created - the error does not happen on
creation - there are two types in two different namespaces - it
happens only on insert where it is not possible to qualify the type's
namespace.
It looks like a bug in the planner to me.

Thanks,
Krzysztof

>
>
>
> cheers
>
> andrew

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rafal Pietrak 2012-04-24 09:37:18 Re: how to make an SQL UPDATE from record returning function
Previous Message Abel Abraham Camarillo Ojeda 2012-04-24 07:48:59 Re: how to make an SQL UPDATE from record returning function

Browse pgsql-hackers by date

  From Date Subject
Next Message Albe Laurenz 2012-04-24 09:40:55 Re: Foreign table scan estimates
Previous Message Ants Aasma 2012-04-24 09:00:55 Re: Gsoc2012 idea, tablesample