Re: [GENERAL] Re: Cannot retrieve images inserted through VB and odbc, after a table reorganization.

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Alanoly Andrews <alanolya(at)invera(dot)com>, 'Craig James' <cjames(at)emolecules(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Re: Cannot retrieve images inserted through VB and odbc, after a table reorganization.
Date: 2014-09-03 19:10:19
Message-ID: 5407679B.2030906@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

On 09/03/2014 09:26 AM, Alanoly Andrews wrote:
> *Hi Craig,*
>
> **
>
> *I’m reloading into the very same database. *
>
> *If I insert a new row into the table (through VB/ODBC), I’m able to
> retrieve it (again from VB). But if after inserting the new row, I do a
> reorg of the table (eg. with a “cluster table”), I’m no longer able to
> retrieve that same row. In short, as long as the newly inserted rows are
> not “re-written” in some way, they can be retrieved through VB/ODBC. *

To follow up on my previous post with regards to OIDs. That may have
been a wrong fork. A little testing:

test=# CREATE TABLE image (
name text,
raster oid
);

test=# create index img_idx on image (raster);

test=# INSERT INTO image (name, raster)
VALUES ('another beautiful image',
lo_import('/home/aklaver/Pictures/IMG_0359JPG'));

test=# INSERT INTO image (name, raster)
VALUES ('another beautiful image',
lo_import('/home/aklaver/Pictures/IMG_0360.JPG'));

test=# INSERT INTO image (name, raster)
VALUES ('another beautiful image',
lo_import('/home/aklaver/Pictures/IMG_0361.JPG'));

test=# select oid, relfilenode from pg_class where relname ='image';
oid | relfilenode
--------+-------------
532144 | 532175

test=# cluster image using img_idx;
CLUSTER
test=# select oid, relfilenode from pg_class where relname ='image';
oid | relfilenode
--------+-------------
532144 | 532182

Note the OID for the table stays the same but the relfilenode changes.
This also happens with the other situations you describe(unless you use
--oids with pg_dump).

So to revise my previous statement, my guess is your VB/ODBC code is
using the relfilenode value to refer to the table and when that changes
it cannot find it any more.

>
> **
>
> *Alanoly.*
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Adrian Klaver 2014-09-03 19:25:43 Re: Re: [ADMIN] Cannot retrieve images inserted through VB and odbc, after a table reorganization.
Previous Message Adrian Klaver 2014-09-03 16:33:05 Re: [GENERAL] Re: Cannot retrieve images inserted through VB and odbc, after a table reorganization.

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-09-03 19:17:48 Re: drop/create/alter amongst difference schemas as non-super user
Previous Message Emi Lu 2014-09-03 17:24:51 drop/create/alter amongst difference schemas as non-super user