Thread: ENUM type script in pgAdmin 1.14.0
Hi All,
I think there is a bug in "CREATE" script for ENUM types created in public schema.
When You execute command:
CREATE TYPE public."MyEnum" AS ENUM
('first','second', 'middle', 'last');
and You use "Create Script" functionality in pgAdmin, the script looks like this:
-- Type: "MyEnum"
-- DROP TYPE "MyEnum";
CREATE TYPE "MyEnum" AS ENUM
('first',
'second',
'middle',
'last');
ALTER TYPE "MyEnum"
OWNER TO postgres;
It seems there is no schema qualified name. It appears regardles search_patch setting. I've tried in different schema and every thing was OK.
This is my fist post, so please don't yell on me ;)
regards,
Bartek
On Sun, 2011-09-25 at 23:13 +0200, bdmytrak@eranet.pl wrote: > Hi All, > I think there is a bug in "CREATE" script for ENUM types created in public schema. > When You execute command: > CREATE TYPE public."MyEnum" AS ENUM > ('first','second', 'middle', 'last'); > and You use "Create Script" functionality in pgAdmin, the script looks like this: > -- Type: " MyEnum " > -- DROP TYPE " MyEnum "; > CREATE TYPE " MyEnum " AS ENUM > (' first ', > ' second ', > ' middle ', > ' last ' ); > ALTER TYPE " MyEnum " > OWNER TO postgres; > It seems there is no schema qualified name. It appears regardles search_patch setting. I've tried in different schema andevery thing was OK. It works for me. I get this: CREATE TYPE "a b"."a strange datatype" AS ENUM ('a', 'b', 'c', 'd'); if the schema "a b" is not in my search_path (at connection time). > This is my fist post, so please don't yell on me ;) We don't yell at people (at lest, most of the time :) ). -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com
<font color="#000000" face="verdana" size="4"><font size="2">Thanks for reply,<br /><br />Maybe my post was not clear, butthis bug occures only for public schema. <br />Please try create enum in "public" not in "a b"<br /><br />Regards,<br/>Bartek<br /></font><br /><font color="black" face="tahoma" id="f74hd9661xnmbjd7" size="4" style="font-size:12px;color:black"><br/>Pozdrawiam, <br />Bartek<br /></font><br /><font color="black" face="tahoma" id="f74hd9661xnmbjd7"size="4" style="COLOR: black; FONT-SIZE: 12px">--- Oryginalna wiadomość ---<br /><br />Od: GuillaumeLelarge [mailto: guillaume@lelarge.info]<br />Wysłane: Monday, September 26, 2011 09:02 AM<br />Do: bdmytrak@eranet.pl<br />Kopia: pgadmin-support@postgresql.org <br />Temat: Re: [pgadmin-support] ENUM type script in pgAdmin1.14.0<br />On Sun, 2011-09-25 at 23:13 +0200, bdmytrak@eranet.pl wrote:<br />> Hi All,<br />> I think thereis a bug in "CREATE" script for ENUM types created in public schema.<br />> When You execute command:<br />> CREATETYPE public."MyEnum" AS ENUM<br />> ('first','second', 'middle', 'last');<br />> and You use "Create Script"functionality in pgAdmin, the script looks like this:<br />> -- Type: " MyEnum "<br />> -- DROP TYPE " MyEnum";<br />> CREATE TYPE " MyEnum " AS ENUM<br />> (' first ',<br />> ' second ',<br />> ' middle ',<br />>' last ' );<br />> ALTER TYPE " MyEnum "<br />> OWNER TO postgres;<br />> It seems there is no schema qualifiedname. It appears regardles search_patch setting. I've tried in different schema and every thing was OK.<br /><br/>It works for me. I get this:<br /><br />CREATE TYPE "a b"."a strange datatype" AS ENUM<br />('a',<br />'b',<br />'c',<br/>'d');<br /><br />if the schema "a b" is not in my search_path (at connection time).<br /><br />> This is myfist post, so please don't yell on me ;)<br /><br />We don't yell at people (at lest, most of the time :) ).<br /><br /><br/>-- <br />Guillaume<br />http://blog.guillaume.lelarge.info<br />http://www.dalibo.com<br /><br /><br />-- <br />Sentvia pgadmin-support mailing list (pgadmin-support@postgresql.org)<br />To make changes to your subscription:<br />http://www.postgresql.org/mailpref/pgadmin-support<br/></font></font>
On Mon, 2011-09-26 at 09:07 +0200, bdmytrak@eranet.pl wrote: > Thanks for reply, > Maybe my post was not clear, but this bug occures only for public schema. > Please try create enum in "public" not in "a b" public is most likely in your search_path, so pgAdmin won't display it. pgAdmin only displays the schema when it's not in your search_path. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com
<font color="#000000" face="verdana" size="4"><font size="2">My search_path is set to "$user", pg_temp<br />so I think scriptshould contain full definition regardles search_path settings (which could change during DB life cycle).<br /><br />Regards<br/>Bartek<br /></font><br /><font color="black" face="tahoma" id="f74hd9661xnmbjd7" size="4" style="font-size:12px;color:black"><br/>Pozdrawiam, <br />Bartek<br /></font><br /><font color="black" face="tahoma" id="f74hd9661xnmbjd7"size="4" style="COLOR: black; FONT-SIZE: 12px">--- Oryginalna wiadomość ---<br /><br />Od: GuillaumeLelarge [mailto: guillaume@lelarge.info]<br />Wysłane: Monday, September 26, 2011 09:12 AM<br />Do: bdmytrak@eranet.pl<br />Kopia: pgadmin-support@postgresql.org <br />Temat: Re: [pgadmin-support] ENUM type script in pgAdmin1.14.0<br />On Mon, 2011-09-26 at 09:07 +0200, bdmytrak@eranet.pl wrote:<br />> Thanks for reply,<br />> Maybemy post was not clear, but this bug occures only for public schema.<br />> Please try create enum in "public" notin "a b"<br /><br />public is most likely in your search_path, so pgAdmin won't display it.<br />pgAdmin only displaysthe schema when it's not in your search_path.<br /><br /><br />-- <br />Guillaume<br />http://blog.guillaume.lelarge.info<br/>http://www.dalibo.com<br /><br /><br />-- <br />Sent via pgadmin-support mailinglist (pgadmin-support@postgresql.org)<br />To make changes to your subscription:<br />http://www.postgresql.org/mailpref/pgadmin-support<br/></font></font>
On Mon, 2011-09-26 at 09:33 +0200, bdmytrak@eranet.pl wrote: > My search_path is set to "$user", pg_temp I tried, and it works for me. I see the public schema in the definition of my type. Best thing to do is open the query tool, and launch "show search_path". And I'm pretty sure you'll find the public schema in it. > so I think script should contain full definition regardles search_path settings (which could change during DB life cycle). Yes and no. We could add an option to always view the schema, regardless of the search_path setting. But one should be able to enable/disable this behaviour. -- Guillaume http://blog.guillaume.lelarge.info http://www.dalibo.com
I made double check (both Win and Linux).
This time everything is OK - schema name is included in script.
This is a little strange for me, because previous script has been copied from script output (without schema name). Right now I cannot reproduce this bug(?) again.
Thanks for Your time.
Bartek
2011/9/26 Guillaume Lelarge <guillaume@lelarge.info>
On Mon, 2011-09-26 at 09:33 +0200, bdmytrak@eranet.pl wrote:I tried, and it works for me. I see the public schema in the definition
> My search_path is set to "$user", pg_temp
of my type.
Best thing to do is open the query tool, and launch "show search_path".
And I'm pretty sure you'll find the public schema in it.Yes and no. We could add an option to always view the schema, regardless
> so I think script should contain full definition regardles search_path settings (which could change during DB life cycle).
of the search_path setting. But one should be able to enable/disable
this behaviour.