pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pf@pfortin.com
To: pgsql-general@lists.postgresql.org
Subject: Re: cache lookup failed for function 0
Date: Sat, 30 Sep 2023 10:01:32 -0400
Message-ID: <20230930100132.44da3c45@pfortin.com> (raw)
In-Reply-To: <8fd58b4c-ef57-3218-b7e3-f087e15db784@aklaver.com>
References: <20230929163739.3bea46e5.pfortin@pfortin.com>
	<8fd58b4c-ef57-3218-b7e3-f087e15db784@aklaver.com>

Hi Adrian,On Fri, 29 Sep 2023 14:27:48 -0700 Adrian Klaver wrote:

>On 9/29/23 1:37 PM, pf@pfortin.com wrote:
>> Hi,
>>
>> select version();
>> PostgreSQL 15.4 on x86_64-mageia-linux-gnu,
>> compiled by gcc (Mageia 12.3.0-3.mga9) 12.3.0, 64-bit
>>
>> As a test, rather than use INSERT, I recently wrote a python test script
>> to import some 8M & 33M record files with COPY instead.  These worked with
>> last weekend's data dump.  Next, I wanted to look into importing a subset
>> of columns using the below logic; but I'm getting "ERROR: cache lookup
>> failed for function 0". Re-running the same full imports that worked
>> Saturday, I now get the same error.
>>
>> Could something in the DB cause this "function" error?
>>
>>
>> Simplified statements; just trying to import a subset of columns:
>>
>> DROP TABLE IF EXISTS t;
>>
>> CREATE TABLE IF NOT EXISTS t (
>> f1 text, f2 text, f3 text, f4 text, f5 text );
>>
>> COPY t ( -- import only a subset of columns  
>
>I'm going to say it is the
>
>( -- import only a subset of columns
>
>I suspect the -- comment is the issue.

I wish it was that easy. It's not in the code; I added that as a
clarification within the email only.

>You need to show the actual Python code for a more complete answer.

Attached...

Source file (44,530 records):
https://s3.amazonaws.com/dl.ncsbe.gov/data/ncvoter53.zip
Attached is a 10 row (incl. header) sample file.

$ dbcopy_voter2 /tmp/ncvoter53_10.txt test ncv53 <db_password>


>> f1, f3, f5 ) FROM '/tmp/foo.txt'
>> WITH (FORMAT CSV, HEADER, DELIMITER ' ', ENCODING 'ISO-8859-1') ;
>>
>> ERROR: cache lookup failed for function 0
>>    Where: COPY t, line 1
>> 1 statement failed.
>>
>> "function"?  Is this referring to an implied/internal function? Searching
>> has not provided any clue, yet...
>>
>> There are no user functions in the database:
>> ostgres=# \df
>>                         List of functions
>>   Schema | Name | Result data type | Argument data types | Type
>> --------+------+------------------+---------------------+------
>> (0 rows)
>>
>> It feels like something changed since the previously working script no
>> longer works...
>>
>> Clues?
>>
>> Thanks,
>> Pierre
>>
>>
>>  
>
>





view thread (16+ messages)  latest in thread

Message-ID: <20230930100132.44da3c45@pfortin.com>
Permalink:  ../20230930100132.44da3c45@pfortin.com/
Also on:    postgresql.org/message-id/20230930100132.44da3c45@pfortin.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: pf@pfortin.com
  Subject: Re: cache lookup failed for function 0
  In-Reply-To: <20230930100132.44da3c45@pfortin.com>
  References: <20230929163739.3bea46e5.pfortin@pfortin.com> <8fd58b4c-ef57-3218-b7e3-f087e15db784@aklaver.com> <20230930100132.44da3c45@pfortin.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox