Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6z84-0004fv-Il for pgsql-general@arkaria.postgresql.org; Tue, 02 Feb 2021 17:06:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6z83-0007Si-G0 for pgsql-general@arkaria.postgresql.org; Tue, 02 Feb 2021 17:06:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6z83-0007Sa-8W for pgsql-general@lists.postgresql.org; Tue, 02 Feb 2021 17:06:15 +0000 Received: from portal-smtp-out.hot.ee ([194.126.101.125]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6z7v-0000sS-HZ for pgsql-general@postgresql.org; Tue, 02 Feb 2021 17:06:14 +0000 Received: from localhost (localhost [127.0.0.1]) by vm-hot-relay10.estpak.ee (Postfix) with ESMTP id B447F1DB0; Tue, 2 Feb 2021 19:06:04 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at vm-hot-relay10.estpak.ee Received: from portal-smtp-out.hot.ee ([127.0.0.1]) by localhost (vm-hot-relay10.estpak.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gm1s-GOANigH; Tue, 2 Feb 2021 19:06:01 +0200 (EET) Received: from mail.hot.ee (hot-relayhost1.estpak.ee [213.180.2.79]) by vm-hot-relay10.estpak.ee (Postfix) with ESMTP id CE2B51D9F; Tue, 2 Feb 2021 19:06:01 +0200 (EET) Subject: Re: permission denied for large object 200936761 To: Adrian Klaver , Laurenz Albe , pgsql-general@postgresql.org References: <47c92baa-949b-92d1-c162-1f0d8348fb50@hot.ee> <2eee8862-ea29-3e9c-30ff-82ec7ad4d99f@aklaver.com> <08f90e7b-8d08-d46e-abb7-85dd68bc3078@hot.ee> <6f141378-2651-3c71-1bab-8b5700e45fbd@hot.ee> <6611d34f7f5ab443a6dbac4a188ba4a1f0ecf196.camel@cybertec.at> <67a7abbc-6039-fee3-23e1-02bccc02376c@aklaver.com> From: Andrus Message-ID: <6efde177-a2b3-5100-d154-61bd2629c2ea@hot.ee> Date: Tue, 2 Feb 2021 19:05:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <67a7abbc-6039-fee3-23e1-02bccc02376c@aklaver.com> Content-Type: multipart/alternative; boundary="------------7DD49527FD5458C631D4FEEE" Content-Language: et List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------7DD49527FD5458C631D4FEEE Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi! > So at that point the deed has been done. > > The questions to ask: > > 1) Why the driver thinks it is being  passed a large object in the > first place? Source data type was binary. It was mapped to oid for unknown reason. > > 2) Have there been any recent changes to code that passes through the > ODBC driver that would account for 1)? > 3) To help with 2), where is 'INSERT INTO report ( ...  ) values (.. , > '200936767'::lo, ... )" coming from? > My suspicion is that it is user initiated change. > This change was done by me. I added new reports from other database. Reports contain primary columns and import throws error about unknown lo type. I removed bonary columns from import and after that import succeeds. It looks like during this procces 3 rows were added to large object metadata table. I used select lo_unlink(oidnumber) to remove them. >If it is not and you suspect the ODBC driver then I would suggest bringing it up on the -odbc list: >https://www.postgresql.org/list/pgsql-odbc/ I created binary data in client side creating FoxPro cursor create cursor t ( t gen  ) and used psqlodbc to insert this data: create temp table test ( test bytea ) on commit drop; insert into test values ( ?t.t ); This code throws exception type "lo" does not exist but each call adds new row to pg_largeobject_metadata table. Odbc driver creates large object and adds lo cast. This large object remains even if transaction is rolled back due to unexisting lo type. C7=0  (bytea as logvarbinary is false) is used in connection string. Andrus. --------------7DD49527FD5458C631D4FEEE Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Hi!
So at that point the deed has been done.

The questions to ask:

1) Why the driver thinks it is being  passed a large object in the first place?

Source data type was binary. It was mapped to oid for unknown reason.



2) Have there been any recent changes to code that passes through the ODBC driver that would account for 1)?
3) To help with 2), where is 'INSERT INTO report ( ...  ) values (.. , '200936767'::lo, ... )" coming from?
My suspicion is that it is user initiated change.

This change was done by me. I added new reports from other database. Reports contain primary columns and import throws error about unknown lo type.

I removed bonary columns from import and after that import succeeds.

It looks like during this procces 3 rows were added to large object metadata table.

I used

select lo_unlink(oidnumber)

to remove them.

>If it is not and you suspect the ODBC driver then I would suggest bringing it up on the -odbc list:
>https://www.postgresql.org/list/pgsql-odbc/

I created binary data in client side creating FoxPro cursor

create cursor t ( t gen  )

and used psqlodbc to insert this data:

create temp table test ( test bytea ) on commit drop;
insert into test values ( ?t.t );

This code throws exception

type "lo" does not exist

but each call adds new row to pg_largeobject_metadata table.

Odbc driver creates large object and adds lo cast. This large object remains even if transaction is rolled back due to unexisting lo type.

C7=0  (bytea as logvarbinary is false) is used in connection string.

Andrus.


--------------7DD49527FD5458C631D4FEEE--