pgAdmin: blank header in the "Edit Data" window if table OID changes

From: Steven Elliott <selliott4(at)austin(dot)rr(dot)com>
To: pgadmin-support(at)postgresql(dot)org
Subject: pgAdmin: blank header in the "Edit Data" window if table OID changes
Date: 2011-04-17 05:48:34
Message-ID: 1303019314.26790.136.camel@grey
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

I noticed that the headers (column names and types at the top of the
table) are blank in the "Edit Data" window (displayed if "View the data
in the selected object" button is pressed) if the table OID changes
while pgAdmin is running. I have this problem (changed table OID) when
I recreate a database from a dump while pgAdmin is running.

Turning on query logging reveals that the issue is that pgAdmin is using
cached OIDs. Refreshing the table (pressing F5 while the table is
selected) fixes the problem. Refreshing also causes pgAdmin to use the
updated OID.

There are various queries involved in displaying the "Edit Data" window,
but consider this one:
SELECT attisdropped
FROM pg_attribute
WHERE attnum > 0 AND attrelid=36214::oid
ORDER BY attnum;
In this case "36214" is the cached and possibly stale table OID. If the
OID is stale then the above returns zero rows, so one possibility is to
reload the table OIDs if the this query returns less rows than expected.
Another is to use the table name in each query, so the above becomes (if
the table is named "my-table"):
SELECT attisdropped
FROM pg_attribute
WHERE attnum > 0 AND attrelid='my-table'::regclass
ORDER BY attnum;
But I suppose that is slower.

I've seen this problem on Fedora 13 i686 as well as Fedora 14 x86_64.
I've seen it with pgAdmin version 1.10.5 as well as latest GIT as of
2011-04-17.

Let me know if there is anything else I can tell you that would be
helpful.

--
------------------------------------------------------------------------
| Steven Elliott | http://selliott.org | selliott4(at)austin(dot)rr(dot)com |
------------------------------------------------------------------------

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Guillaume Lelarge 2011-04-17 12:55:56 Re: pgAdmin: blank header in the "Edit Data" window if table OID changes
Previous Message John Pagakis 2011-04-16 19:19:40 PGAdmin - saving result sets from queries where one or more columns are of the type boolean