Even if we don't solve the issue, I'm hoping this will at least serve as a guide to other folks who encounter this error (that said, the other issues mentioning prepared statements that I saw in the issue tracker were NOT related to this issue). In my specific case, I saw this error using executemany with misspelled columns.
Basically, when you run executemany() with a mis-spelled column (psycopg 3.1.9), there appears to be a failed attempt to prepare a statement, along with reporting the correct error (see details below). On subsequent runs, you don't get the SQL error. Instead, you get an error instead that the prepared statement doesn't exist. This is basically a documentation bug, except it may require additional logic to catch the failed prepare statement.
My guess is that this is at the level of something I can figure out, but I wanted to post this at least for visibility to others in case I don't get time to get to it - if folks see this error message, step one is to check the spelling of columns.
Even if we don't solve the issue, I'm hoping this will at least serve as a guide to other folks who encounter this error (that said, the other issues mentioning prepared statements that I saw in the issue tracker were NOT related to this issue). In my specific case, I saw this error using executemany with misspelled columns.
Basically, when you run executemany() with a mis-spelled column (psycopg 3.1.9), there appears to be a failed attempt to prepare a statement, along with reporting the correct error (see details below). On subsequent runs, you don't get the SQL error. Instead, you get an error instead that the prepared statement doesn't exist. This is basically a documentation bug, except it may require additional logic to catch the failed prepare statement.
My guess is that this is at the level of something I can figure out, but I wanted to post this at least for visibility to others in case I don't get time to get to it - if folks see this error message, step one is to check the spelling of columns.