Skip site navigation (1) Skip section navigation (2)

Re: "set schema" patch

From: Dave Page <dpage(at)postgresql(dot)org>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: "set schema" patch
Date: 2007-12-30 18:14:56
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgadmin-hackers
Hi Guillaume

Apologies, but I'm *really* busy right now (with upcoming pgAdmin,
PostgreSQL and EnterpriseDB releases) so haven't yet had a chance to
properly review your patches. I'll answer what I can for now - it I
haven't reviewed within a week or so of the pgAdmin release, please feel
free to give me a verbal kick.

Guillaume Lelarge wrote:
> Hi,
> This patch adds a schema combobox on some objets' dialog : aggregate,
> conversion, domain, function, sequence, table, type, view. There are two
> EDB objects that probably need it too : package and synonym. Dave, can
> you tell me if they are dependants on schema ? and do they use the same
> SQL statement to alter their schema ? thanks.

Public Synonyms live at the same logical level as Schemas, so they re
unaffected by this patch.

Packages are modified using CREATE OR REPLACE, which of course won't
allow you to change the schema in itself, but you could create the new
package in the new schema, and then drop the old. The problem with that
 (and changing the schema of other objects) is figuring out what nodes
to refresh.

> The patch attached is not finished. I have one big issue with it. It
> seems I can't alter the schema of a function. The call to ShowObject()
> in dlgProperty::apply() fails. It seems this statement
>   pgObject *newData=data->Refresh(mainForm->GetBrowser(), item);
> crashes pgAdmin (core dump), but I have no clue to explain this. It
> don't even know why it crashes with functions, but works with the other
> objects.
> If I can find a solution to this issue, it'll probably solve this second
> (and last) issue. I've put some of my code in comments in OnOK()
> function. I wrote this code to refresh the "Schemas" node. It seemed to
> work fine Thursday morning, but didn't want to work since. Is there
> something wrong with my way to refresh the "Schemas" node? Is there
> another way ?

Refreshing is a real pita - the Refresh function in the pgObject and
derived classes was originally designed to do exactly that, but these
days has subtly changed such that it no longer works as you need (and
how even I expect in most cases).

We should really add a sure-fire way to refresh the tree as you expect
in SVN-Trunk (or figure out what the heck Refresh() really does these
days). Recently though, I used code like this to refresh the Functions
collection node in the case that the debugger finds a function no longer

ctlTree *browser = form->GetBrowser();
wxTreeItemId item=browser->GetSelection();
if (obj == browser->GetObject(item))
    pgCollection *coll=browser->GetParentCollection(obj->GetId());


In response to


pgadmin-hackers by date

Next:From: Dave PageDate: 2007-12-30 18:35:14
Subject: Re: Schema and tablespace
Previous:From: svnDate: 2007-12-30 17:59:09
Subject: SVN Commit by dpage: r6922 - branches/REL-1_8_0_PATCHES/pgadmin3/i18n/zh_TW

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group