jackc / jackc/tern

Error initializing migrator: ERROR: prepared statement already exists (SQLSTATE 42P05)

Open
#100 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.3k
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have three migrations: a pg dump in it's entirety and two subsequent, smaller changes. In the pg dump I had an ownership change and that didn't work. The migration failed. I fixed that, but since then I get the following:

```
Error initializing migrator:
ERROR: prepared statement "stmtcache_f79766b7ce94605d03a610756ccc50f2971d8e6d09672dec" already exists (SQLSTATE 42P05)
```

I have no idea how to get rid of that. I can't deallocate it, I can't deallocate all. I did the first migration manually and bumped the version. Still running into that. One migration did work via tern, but can't reproduce/remember exactly. I can't use tern anymore because I always get this error. How do I get rid of it? I don't use any prepared statements. I can't find any code related to this and I don't see anything in my db related to this. What's going on?

Contributor guide

No contributing guide indexed for this repository

Research direction

The report names no source files, tests, or entry points. Start by reproducing migrator initialization with the pg dump and subsequent migrations, then trace the PostgreSQL prepared-statement error. Done means identifying a reproducible cause and agreeing on the scope of a fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.