Thread: pgadmin3 gets oid for schema wrong

pgadmin3 gets oid for schema wrong

From
Richard van den Berg
Date:
I have this weird problem where pgadmin3 shows empty schema's 
(tables(0), views(0), etc) while they are not empty at all. I upgraded 
to the 1.2.0-0.0+beta2.0 debian package, but the problem persists.

Refreshing the schema causes the schema to disappear from the pgadmin3 
tree. This is the query I see executed when doing the refresh:

SELECT CASE WHEN nspname LIKE 'pg\_temp\_%%' THEN 1            WHEN nsp.oid<17140 OR nspname like 'pg\_%' THEN 0
   ELSE 2 END as nsptyp,       nsp.nspname, nsp.oid, pg_get_userbyid(nspowner) AS 
 
namespaceowner, nspacl, description, has_schema_privilege(nsp.oid, 'CREATE') FROM pg_namespace nsp LEFT OUTER JOIN
pg_descriptiondes ON des.objoid=nsp.oid
 
WHERE nsp.oid=2147483647::oid
ORDER BY 1, nspname

I examined pg_namespace and the oid of the schema actually is 
2518196330. No wonder pgadmin3 thinks it's empty.

Refreshing the "schema's" tree executes this statement:

SELECT CASE WHEN nspname LIKE 'pg\_temp\_%%' THEN 1            WHEN nsp.oid<17140 OR nspname like 'pg\_%' THEN 0
   ELSE 2 END AS nsptyp,       nsp.nspname,       nsp.oid,       pg_get_userbyid(nspowner) AS namespaceowner,
nspacl,      description,       has_schema_privilege(nsp.oid, 'CREATE') FROM pg_namespace nsp LEFT OUTER JOIN
pg_descriptiondes ON des.objoid=nsp.oid
 
WHERE (nsp.nspname NOT LIKE 'pg\_%' AND nsp.nspname NOT LIKE 
'information_schema')
ORDER BY 1, nspname

The result of this query does list the schema with the correct OID 
(2518196330).

The question is: why does pgadmin3 think the oid for the schema is 
2147483647 ?

I have this problem with a bunch of schema's, which makes pgadmin3 quite 
useless for me at the moment.

Please Cc me in the discussion, as I am not on this list.

Sincerely,

-- 
Richard van den Berg, CISSP

Trust Factory B.V.      | http://www.trust-factory.com/
Bazarstraat 44a         | Phone: +31 70 3620684
NL-2518AK The Hague     | Fax  : +31 70 3603009
The Netherlands         |


Re: pgadmin3 gets oid for schema wrong

From
Andreas Pflug
Date:
Richard van den Berg wrote:
> I have this weird problem where pgadmin3 shows empty schema's 
> (tables(0), views(0), etc) while they are not empty at all. I upgraded 
> to the 1.2.0-0.0+beta2.0 debian package, but the problem persists.
> 
> Refreshing the schema causes the schema to disappear from the pgadmin3 
> tree. This is the query I see executed when doing the refresh:
> 
> SELECT CASE WHEN nspname LIKE 'pg\_temp\_%%' THEN 1
>             WHEN nsp.oid<17140 OR nspname like 'pg\_%' THEN 0
>             ELSE 2 END as nsptyp,
>        nsp.nspname, nsp.oid, pg_get_userbyid(nspowner) AS 
> namespaceowner, nspacl, description, has_schema_privilege(nsp.oid, 
> 'CREATE')
>  FROM pg_namespace nsp
>  LEFT OUTER JOIN pg_description des ON des.objoid=nsp.oid
> WHERE nsp.oid=2147483647::oid
> ORDER BY 1, nspname
> 
> I examined pg_namespace and the oid of the schema actually is 
> 2518196330. No wonder pgadmin3 thinks it's empty.

2147483647 is 0x7fffffff, i.e. LONG_MAX. Apparently, some function is 
cutting down the real oid value, which is 0x9618a06a.

Digging into the sources, I found two places where oids are converted 
using atol, which might be the offending function. I changed both to 
strtoul, and committed the changes to cvs.
Please check it (misc.cpp and pgSet.cpp affected) from source if 
possible or try Beta3, which we're be rolling quite soon an give us 
feedback because I don't have a test case.

Some remark:
Apparently your database consumes enormous amounts of oids, you're more 
than half way to a oid wrap which might cause undesired effects 
(duplicate oids). Your tables are probably all created WITH OIDS, which 
is still the default. You might consider dropping the oid columns, if 
you don't need them.

Regards,
Andreas


Re: pgadmin3 gets oid for schema wrong

From
Richard van den Berg
Date:
Andreas Pflug wrote:
> Digging into the sources, I found two places where oids are converted 
> using atol, which might be the offending function. I changed both to 
> strtoul, and committed the changes to cvs.

Thanks for the fast response (and possible fix).

> Please check it (misc.cpp and pgSet.cpp affected) from source if 
> possible or try Beta3, which we're be rolling quite soon an give us 
> feedback because I don't have a test case.

Unfortunately, I cannot compile the CVS tree:

ui/dlgEditGridOptions.cpp:51: error: `wxID_REMOVE' was not declared in 
this scope

Perhaps this has to do with the fact that I use wxWidgets 5.1.1 (5.3.x 
is not available as Debian packages yet). I'll wait for the Beta3 to 
come out.

> Apparently your database consumes enormous amounts of oids, you're more 
> than half way to a oid wrap which might cause undesired effects 
> (duplicate oids).

We have a lot of data passing through our database, not necessarily 
staying in there. The uniqueness of the OIDs for us is only important 
within the schema (within the table in most cases). Since each time we 
load new data, a new schema is created I'm not too afraid for 
duplicates. Thanks for the note though.

Sincerely,

-- 
Richard van den Berg, CISSP

Trust Factory B.V.      | http://www.trust-factory.com/
Bazarstraat 44a         | Phone: +31 70 3620684
NL-2518AK The Hague     | Fax  : +31 70 3603009
The Netherlands         |


Re: pgadmin3 gets oid for schema wrong

From
blacknoz@club-internet.fr
Date:
----Message d'origine----
>Date: Fri, 15 Oct 2004 15:45:27 +0200
>De: Richard van den Berg <richard.vandenberg@trust-factory.com>
>A: Andreas Pflug <pgadmin@pse-consulting.de>
>Copie à: pgadmin-support@postgresql.org
>Sujet: Re: [pgadmin-support] pgadmin3 gets oid for schema wrong
>
>Andreas Pflug wrote:
>
>Unfortunately, I cannot compile the CVS tree:
>
>ui/dlgEditGridOptions.cpp:51: error: `wxID_REMOVE' was not declared in
>this scope
>
>Perhaps this has to do with the fact that I use wxWidgets 5.1.1 (5.3.x
>is not available as Debian packages yet). I'll wait for the Beta3 to
>come out.

Yes, you need to use wxWid 2.5.3 to build pga3. Generally we provide a supported tarball of wxWid there:
http://pgadmin.postgresql.org/snapshots/wxWidgets/
But I can't find the one for 2.5.3. Maybe in preparation (andreas ?).

At the time of this writing, my daily builds for debian are broken. I'll drop a line when they will be back to a
functionalstate so that you can try a daily snapshot until beta3 is out. 

Regards,
Raphaël



Re: pgadmin3 gets oid for schema wrong

From
Andreas Pflug
Date:
Richard van den Berg wrote:
> Andreas Pflug wrote:
> 
>> Digging into the sources, I found two places where oids are converted 
>> using atol, which might be the offending function. I changed both to 
>> strtoul, and committed the changes to cvs.
> 
> 
> Thanks for the fast response (and possible fix).
> 
>> Please check it (misc.cpp and pgSet.cpp affected) from source if 
>> possible or try Beta3, which we're be rolling quite soon an give us 
>> feedback because I don't have a test case.
> 
> 
> Unfortunately, I cannot compile the CVS tree:
> 
> ui/dlgEditGridOptions.cpp:51: error: `wxID_REMOVE' was not declared in 
> this scope
> 
> Perhaps this has to do with the fact that I use wxWidgets 5.1.1 (5.3.x 
> is not available as Debian packages yet). I'll wait for the Beta3 to 
> come out.

You probably mean 2.5.1/2.5.3? Since 2.5.3 is out now officially, the 
debian package will be availabe too RSN I believe (maybe it is already 
at www.wxwidgets.org).

In any case, we'd appreciate further feedback on this topic (positive or 
negative).

Regards,
Andreas


unsubscribe

From
kedaly@bfacolor.com
Date:
<br /><font face="sans-serif" size="2">unsubscribe</font>

Re: pgadmin3 gets oid for schema wrong

From
Andreas Pflug
Date:
blacknoz@club-internet.fr wrote:
> ----Message d'origine----


> 
> Yes, you need to use wxWid 2.5.3 to build pga3. Generally we provide a supported tarball of wxWid there:
> http://pgadmin.postgresql.org/snapshots/wxWidgets/
> But I can't find the one for 2.5.3. Maybe in preparation (andreas ?).

Currently we don't need private snapshots any more, so a vanilla 
wxGTK2.5.3 from wxwidgets.org is the right one. We have good feedback on 
wxMSW too, but we (I) will have to confirm that; then we'll roll Beta3.

Both wxGTK2.5.3 and our latest snapshot may be used, might a little 
tweaking because the xrc library is not contrib any more but included in 
the main lib.

Regards,
Andreas




Re: pgadmin3 gets oid for schema wrong

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Andreas Pflug
> Sent: 15 October 2004 15:15
> To: blacknoz@club-internet.fr
> Cc: richard.vandenberg@trust-factory.com;
> pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] pgadmin3 gets oid for schema wrong
>
> We have good
> feedback on wxMSW too, but we (I) will have to confirm that;
> then we'll roll Beta3.

Well, unfortunately the precompiled version is no good as
wxDIALOG_UNIT_COMPATIBILITY is not set to 0.

Just downloading the source zip file now...

/D


Re: pgadmin3 gets oid for schema wrong

From
Andreas Pflug
Date:
Dave Page wrote:
>  
> 
> 
>>-----Original Message-----
>>From: pgadmin-support-owner@postgresql.org 
>>[mailto:pgadmin-support-owner@postgresql.org] On Behalf Of 
>>Andreas Pflug
>>Sent: 15 October 2004 15:15
>>To: blacknoz@club-internet.fr
>>Cc: richard.vandenberg@trust-factory.com; 
>>pgadmin-support@postgresql.org
>>Subject: Re: [pgadmin-support] pgadmin3 gets oid for schema wrong
>>
>>We have good 
>>feedback on wxMSW too, but we (I) will have to confirm that; 
>>then we'll roll Beta3.
> 
> 
> Well, unfortunately the precompiled version is no good as
> wxDIALOG_UNIT_COMPATIBILITY is not set to 0.
> 
> Just downloading the source zip file now...

Oh I didn't expect the binary version to work anyway, it's probably not 
even Unicode.

Our MSW compilation instructions should contain a matching setup.h 
version as well.

Regards,
Andreas



Re: pgadmin3 gets oid for schema wrong

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 15 October 2004 16:05
> To: Dave Page
> Cc: pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] pgadmin3 gets oid for schema wrong
>
> Oh I didn't expect the binary version to work anyway, it's
> probably not even Unicode.

Yeah, but I was hoping... :-)

> Our MSW compilation instructions should contain a matching
> setup.h version as well.

Don't remember ever having one. I just set wxDIALOG_UNIT_COMPATIBILITY =
0 and wxUSE_UNICODE = 1.

Anything missing from that?

Regards, Dave.


Re: pgadmin3 gets oid for schema wrong

From
Andreas Pflug
Date:
Dave Page wrote: gets oid for schema wrong
>>
>>Oh I didn't expect the binary version to work anyway, it's 
>>probably not even Unicode.
> 
> 
> Yeah, but I was hoping... :-)

Hope dies last :-)
 >>Our MSW compilation instructions should contain a matching
>>setup.h version as well.
> 
> 
> Don't remember ever having one. 

We kind-of always had, in the snapshot, no?

> I just set wxDIALOG_UNIT_COMPATIBILITY =
> 0 and wxUSE_UNICODE = 1.
> 
> Anything missing from that?

That's the most important, but the others should be reviewed too. 
(wxUSE_MIMETYPE=0 seems a good idea too, no exceptions, ...)

The question is, how to supply that? We'd probably need one version for 
each wx version. Maybe some day there's more than one version pgAdmin 
compiles with.

Regards,
Andreas


Re: pgadmin3 gets oid for schema wrong

From
"Dave Page"
Date:

> -----Original Message-----
> From: Andreas Pflug [mailto:pgadmin@pse-consulting.de]
> Sent: 15 October 2004 16:25
> To: Dave Page
> Cc: pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] pgadmin3 gets oid for schema wrong
>
> > Don't remember ever having one.
>
> We kind-of always had, in the snapshot, no?

Err, don't think so.

> > I just set wxDIALOG_UNIT_COMPATIBILITY = 0 and wxUSE_UNICODE = 1.
> >
> > Anything missing from that?
>
> That's the most important, but the others should be reviewed too.
> (wxUSE_MIMETYPE=0 seems a good idea too, no exceptions, ...)
>
> The question is, how to supply that? We'd probably need one
> version for each wx version.

Not sure. Setup.h-2.5.3 ? Not a nice Windows filename though.

> Maybe some day there's more than
> one version pgAdmin compiles with.

Yeah, I'm assuming that. As this is a released version I was going to
move it into C:\wxWidgets-2.5.3 (the default location) to get some sort
of version control in the build.

/D


Re: pgadmin3 gets oid for schema wrong

From
Richard van den Berg
Date:
Andreas Pflug wrote:
> You probably mean 2.5.1/2.5.3? Since 2.5.3 is out now officially, the 
> debian package will be availabe too RSN I believe (maybe it is already 
> at www.wxwidgets.org).

You're right, sorry about the version mixup. There are no DEB (or RPM) 
files at www.wxwidgets.org for 2.5.3 at this moment. The official 
experimental debian packages are stuck at 2.5.1.

> In any case, we'd appreciate further feedback on this topic (positive or 
> negative).

Compiling wxwidgets is too much of an effort right now. I'll give it a 
try over the weekend.

-- 
Richard van den Berg, CISSP

Trust Factory B.V.      | http://www.trust-factory.com/
Bazarstraat 44a         | Phone: +31 70 3620684
NL-2518AK The Hague     | Fax  : +31 70 3603009
The Netherlands         |


Re: pgadmin3 gets oid for schema wrong

From
Richard van den Berg
Date:
Andreas Pflug wrote:
> In any case, we'd appreciate further feedback on this topic (positive or 
> negative).

Ok, I compile wxwindows 2.5.3 from source and pgadmin3 using the current 
CVS version. I can see the content of the schemas now!

Thanks a lot for the quick fix.

-- 
Richard van den Berg, CISSP

Trust Factory B.V.      | http://www.trust-factory.com/
Bazarstraat 44a         | Phone: +31 70 3620684
NL-2518AK The Hague     | Fax  : +31 70 3603009
The Netherlands         |


Re: pgadmin3 gets oid for schema wrong

From
Andreas Pflug
Date:
Richard van den Berg wrote:
> Andreas Pflug wrote:
> 
>> In any case, we'd appreciate further feedback on this topic (positive 
>> or negative).
> 
> 
> Ok, I compile wxwindows 2.5.3 from source and pgadmin3 using the current 
> CVS version. I can see the content of the schemas now!

Thanks for the feedback!

Regards,
Andreas