Re: Bug with Foreign table interface

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Thom Brown <thom(at)linux(dot)com>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Bug with Foreign table interface
Date: 2011-04-29 23:41:11
Message-ID: 4DBB4C97.2060605@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

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

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2011-04-29 23:42:42 pgAdmin III commit: Fix lots of bugs in foreign table support
Previous Message Erwin Brandstetter 2011-04-29 14:55:15 v1.14 beta1: Ctrl-C does not copy selected text inside a textbox in the edit grid