Thread: BUG #2644: pgadmin III foreign key

BUG #2644: pgadmin III foreign key

From
"Massimiliano Citterio"
Date:
The following bug has been logged online:

Bug reference:      2644
Logged by:          Massimiliano Citterio
Email address:      massicitte@libero.it
PostgreSQL version: 8.1.4
Operating system:   Windows 2003
Description:        pgadmin III  foreign key
Details:

The referencing column dropdown listbox not filled with fields from
referenced table.

The case appear after doing the following actions.

Create a schema named like $user (ex. "postgres").
Delete Schema "Public".
Refresh the Database View...
Now the default Schema for the database is "postgres"

create tables, the try to create foreign keys using the GUI.
There is no way.

If you create a new schema "public" it does not works.

If you create a new schema "public" and rename the "postgres" schema to
something else the it works.

If you drop schema "postgres" create schema "public" and then recreate
schema postgres and his tables, then foreign key GUI works.

May be the GUI search for schema "public" but it must have an OID lesser of
all other schemas in the searchpath.

Infact the default search path is $user, public.

By the way it does not work if a schema named public does not exist.

Re: BUG #2644: pgadmin III foreign key

From
"Dave Page"
Date:
=20

> -----Original Message-----
> From: pgsql-bugs-owner@postgresql.org=20
> [mailto:pgsql-bugs-owner@postgresql.org] On Behalf Of=20
> Massimiliano Citterio
> Sent: 22 September 2006 09:21
> To: pgsql-bugs@postgresql.org
> Subject: [BUGS] BUG #2644: pgadmin III foreign key
>=20
>=20
> The following bug has been logged online:
>=20
> Bug reference:      2644
> Logged by:          Massimiliano Citterio
> Email address:      massicitte@libero.it
> PostgreSQL version: 8.1.4
> Operating system:   Windows 2003
> Description:        pgadmin III  foreign key
> Details:=20
>=20
> The referencing column dropdown listbox not filled with fields from
> referenced table.
>=20
> The case appear after doing the following actions.
>=20
> Create a schema named like $user (ex. "postgres").
> Delete Schema "Public".
> Refresh the Database View...
> Now the default Schema for the database is "postgres"
>=20
> create tables, the try to create foreign keys using the GUI.
> There is no way.
>=20
> If you create a new schema "public" it does not works.
>=20
> If you create a new schema "public" and rename the "postgres"=20
> schema to
> something else the it works.
>=20
> If you drop schema "postgres" create schema "public" and then recreate
> schema postgres and his tables, then foreign key GUI works.
>=20
> May be the GUI search for schema "public" but it must have an=20
> OID lesser of
> all other schemas in the searchpath.
>=20
> Infact the default search path is $user, public.
>=20
> By the way it does not work if a schema named public does not exist.

I cannot reproduce this in the 1.6 development code - can you test beta
1 please?

Regards, Dave.

Re: BUG #2644: pgadmin III foreign key

From
"Dave Page"
Date:
=20

> -----Original Message-----
> From: massicitte@libero.it [mailto:massicitte@libero.it]=20
> Sent: 27 September 2006 17:09
> To: Dave Page
> Subject: RE: [BUGS] BUG #2644: pgadmin III foreign key
>=20
> ---------- Initial Header -----------
>=20
> From      : "Dave Page" dpage@vale-housing.co.uk
> To          : massicitte@libero.it
> Cc          :=20
> Date      : Tue, 26 Sep 2006 17:03:18 +0100
> Subject : RE: [BUGS] BUG #2644: pgadmin III  foreign key
>=20
>=20
> OK thank you.=20
> I try Version 1.6 beta 1  and I find very good improvements but
> I'm sorry Foreign key wizard still do not work properly.
>=20
> Access the db with user postgres;
> Create DB  test;
> create schema postgres;
> drop schema public;
> Disconnect;
> Access the db with user postgres;
> create table1;
> create table2;
>=20
>=20
> create foreign key on table1 for table2  does not work with=20
> GUI, you need to write the SQL CODE.

That works perfectly for me. Are you trying to reference properly
indexed columns? What do your table definitions look like?


> I download the sources, if i have time i will search where is=20
> the problem.

OK, thanks.=20

Regards, Dave.

Re: BUG #2644: pgadmin III foreign key

From
"Dave Page"
Date:
=20

> -----Original Message-----
> From: massicitte@libero.it [mailto:massicitte@libero.it]=20
> Sent: 28 September 2006 15:08
> To: Dave Page
> Subject: RE: [BUGS] BUG #2644: pgadmin III foreign key
>=20
> This is a backup of the test db with the problem...
>=20
> I generate it all with pgAdmin  without SQLcode.

OK.

> I create  the database with "New Database" and so on

OK, done here.
=20
> When I Arrive to "New object" - "New foreign key"=20=20
> i can not complete the task because i have no recerencing=20
> column to choose from.

I see test1 and test2 when I select the referenced table.
=20
> When you restore the backup on a template0 inherited db ,=20
> drop the schema public.

I have.

> It know that it could be stupid to drop the public schema but=20
> Some development platform like Sybase Powerbuilder refer to=20
> user schema  and not to public schema... so Someone could=20
> think of dropping public schema...=20

No, there's no reason to keep public if you don't need it. It's
primarily there foe backwards compatibility.

> To see the problem you have to disconnect an reconnect Before=20
> doing New foreign key.

I have done. pgAdmin allows me to define the foreign key from table1 to
table2, but upon clicking OK, gives the following error:

---------------------------
pgAdmin III
---------------------------
An error has occured:

ERROR:  there is no unique constraint matching given keys for referenced
table "test2"

---------------------------
OK=20=20=20
---------------------------

Which is exactly what I'd expect. In my previous testing, I defined
primary keys so that wasn't an issue. Can anyone else reproduce this
problem?

Regards, Dave=20

Re: BUG #2644: pgadmin III foreign key

From
"Dave Page"
Date:
=20

> -----Original Message-----
> From: massicitte@libero.it [mailto:massicitte@libero.it]=20
> Sent: 28 September 2006 18:37
> To: Dave Page
> Subject: RE: [BUGS] BUG #2644: pgadmin III foreign key
>=20
> ---------- Initial Header -----------
>=20
> From      : "Dave Page" dpage@vale-housing.co.uk
> To          : massicitte@libero.it
> Cc          : pgsql-bugs@postgresql.org
> Date      : Thu, 28 Sep 2006 16:11:40 +0100
> Subject : RE: [BUGS] BUG #2644: pgadmin III  foreign key
>=20
>=20
>=20
> I try installing on another PC, because I do not arrive to=20
> that error. I really can not see the fields from table2  into=20
> the foreign key wizard, if I previously drop public schema.

Oh, I don't disbelieve you - there must be something else affecting
things in your setup that doesn't affect mine. What PostgreSQL version
are you running on?

Regards, Dave

Re: BUG #2644: pgadmin III foreign key

From
"Dave Page"
Date:
=20

> -----Original Message-----
> From: massicitte@libero.it [mailto:massicitte@libero.it]=20
> Sent: 29 September 2006 11:10
> To: Dave Page
> Subject: RE: [BUGS] BUG #2644: pgadmin III foreign key
>=20
> ---------- Initial Header -----------
>=20
> From      : "Dave Page" dpage@vale-housing.co.uk
> To          : massicitte@libero.it
> Cc          : pgsql-bugs@postgresql.org
> Date      : Fri, 29 Sep 2006 09:14:14 +0100
> Subject : RE: [BUGS] BUG #2644: pgadmin III  foreign key
>=20
> I try  8.1.4  and 7.4.7 Servers
>=20
> On Windows 2003 server and Fedora core2 linux Server

I've been testing on 8.1.4 (win32), 8.0.7 (slackware linux) and 8.2 beta
1 (win32).
=20
> and I try PgAdmin 1.4.3 on WinXp and Win2000 systems
> and PgAdmin 1.6 beta 1 on WinXp system

Although I did try 1.4.3 earlier, I'm working on 1.6 mainly.

> All combinations, the same results
>
> All system are in Italian language
> PgAdmin is in english
>=20
> I have some problems to load Sources with Dev C++ 4.9.9.2
> I'm searching for A Setup of MS VC++ 6.0 to load the sources.

Use the 1.6 SVN trunk code (or a recent snapshot) with Visual C++ 2005
Express which is now a free download from Microsoft. The build
environment is documented at http://www.pgadmin.org/download/source.php

Regards, Dave