Обсуждение: Bug with Foreign table interface

Поиск
Список
Период
Сортировка

Bug with Foreign table interface

От
Thom Brown
Дата:
This is for pgAdmin 1.14 beta 1 on OSX.

When setting up a foreign table, upon adding a column, the "Member
name" and "Data type" values remain in the input fields.

Also, upon attempting to open a foreign table, pgAdmin is displaying
the message "An error has occurred: No Table or view" and then
crashes.  The error message on the server is: "LOG:  unexpected EOF on
client connection"

Steps to recreate:

1) Install the file_fdw extension
2) Create a server called "file" using this extension
3) Create a foreign table using the following definition:

CREATE FOREIGN TABLE stuff (id int, animal text) SERVER 'file' OPTIONS
(format 'text', filename '/tmp/stuff.txt', delimiter ',');

Also create a file in /tmp/stuff.txt with the following contents:

1,Llama
2,Dog
3,Sheep
4,Whale
5,Lizard

Using psql, the following query works fine:

postgres=# select * from stuff;
 id | animal
----+--------
  1 | Llama
  2 | Dog
  3 | Sheep
  4 | Whale
  5 | Lizard
(5 rows)

When just clicking on the foreign table name in the browser, I can see
the definition in the SQL pane.  If I click in that pane, pgAdmin
crashes again.  It is displaying the following in the pane:

-- Foreign table: stuff

-- DROP FOREIGN TABLE stuff;

CREATE FOREIGN TABLE stuff
   (id integer ,
    animal text )
   SERVER file
   OPTIONS (format=text,delimiter=,,filename=/tmp/stuff.txt);
ALTER FOREIGN TABLE stuff OWNER TO thom;

So there appears to be single quotes missing from the options section.
 I never entered them in the actual interface to create the foreign
table, but pgAdmin was showing the correct creation SQL in the editor.
 It is also displaying = between the parameter and value in the
options list, but this isn't valid.

The same problem appears in the properties tab for the foreign table.
It displays the options list in the same way, without quotes and uses
= between parameter and value.

Also, when I was in the editor, when clicking on the SQL tab and
clicking on the text, it also crashes.

I also don't see where user mappings are shown in the interface.  I
have every browser object set to display including user mappings.

One last thing, I don't see the server named "file" appearing in the
Dependents list for file_fdw.  My "stuff" table appears in the
Dependents list for my server called "file", but it says "Unknown" in
the Type column.  This relationship is not reciprocated as the foreign
table doesn't show any dependency on the foreign server, and the
foreign server shows no dependency on the file_fdw extension.

Regards

--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Bug with Foreign table interface

От
Guillaume Lelarge
Дата:
Le 28/04/2011 16:10, Thom Brown a écrit :
> This is for pgAdmin 1.14 beta 1 on OSX.
>
> When setting up a foreign table, upon adding a column, the "Member
> name" and "Data type" values remain in the input fields.
>

Fixed.

> Also, upon attempting to open a foreign table, pgAdmin is displaying
> the message "An error has occurred: No Table or view" and then
> crashes.  The error message on the server is: "LOG:  unexpected EOF on
> client connection"
>

Fixed too.

> Steps to recreate:
>
> 1) Install the file_fdw extension
> 2) Create a server called "file" using this extension
> 3) Create a foreign table using the following definition:
>
> CREATE FOREIGN TABLE stuff (id int, animal text) SERVER 'file' OPTIONS
> (format 'text', filename '/tmp/stuff.txt', delimiter ',');
>
> Also create a file in /tmp/stuff.txt with the following contents:
>
> 1,Llama
> 2,Dog
> 3,Sheep
> 4,Whale
> 5,Lizard
>
> Using psql, the following query works fine:
>
> postgres=# select * from stuff;
>  id | animal
> ----+--------
>   1 | Llama
>   2 | Dog
>   3 | Sheep
>   4 | Whale
>   5 | Lizard
> (5 rows)
>
> When just clicking on the foreign table name in the browser, I can see
> the definition in the SQL pane.  If I click in that pane, pgAdmin
> crashes again.  It is displaying the following in the pane:
>
> -- Foreign table: stuff
>
> -- DROP FOREIGN TABLE stuff;
>
> CREATE FOREIGN TABLE stuff
>    (id integer ,
>     animal text )
>    SERVER file
>    OPTIONS (format=text,delimiter=,,filename=/tmp/stuff.txt);
> ALTER FOREIGN TABLE stuff OWNER TO thom;
>
> So there appears to be single quotes missing from the options section.
>  I never entered them in the actual interface to create the foreign
> table, but pgAdmin was showing the correct creation SQL in the editor.
>  It is also displaying = between the parameter and value in the
> options list, but this isn't valid.
>

Yea, I thought the contents of the ftoptions field was compatible with
the CREATE FOREIGN TABLE syntax, but it appears it isn't. So I had to
implement a parse function which was quite difficult (hence the comments
in the function).

Fixed.

> The same problem appears in the properties tab for the foreign table.
> It displays the options list in the same way, without quotes and uses
> = between parameter and value.
>

Fixed.

> Also, when I was in the editor, when clicking on the SQL tab and
> clicking on the text, it also crashes.
>

Seems to be fixed.

> I also don't see where user mappings are shown in the interface.  I
> have every browser object set to display including user mappings.
>

Under foreign servers.

> One last thing, I don't see the server named "file" appearing in the
> Dependents list for file_fdw.  My "stuff" table appears in the
> Dependents list for my server called "file", but it says "Unknown" in
> the Type column.  This relationship is not reciprocated as the foreign
> table doesn't show any dependency on the foreign server, and the
> foreign server shows no dependency on the file_fdw extension.
>

Still need to works on this.

Thanks for this complete bug report.


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com