Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8992081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:52:23+00:00 2026-06-15T22:52:23+00:00

In our PostgreSQL-backed Rails project, when running rspec using spork, sometimes we receive the

  • 0

In our PostgreSQL-backed Rails project, when running rspec using spork, sometimes we receive the following error:

ActiveRecord::StatementInvalid:
   PG::Error: ERROR:  prepared statement "a1" already exists

Originally, it occurred only a few times a day, but recently, it has begun happening every 3-4 test runs which slows our development efforts to a crawl.

Is there a way to reset/delete the prepared statements in PostgreSQL somewhere inside of our spec_helper.rb file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:52:24+00:00Added an answer on June 15, 2026 at 10:52 pm

    After searching the PostgreSQL docs and a fair amount of trial and error testing it in different spots inside the spec_helper.rb, I finally figured out that I could add the following to delete all existing prepared statements and I have not since seen the error:

    RSpec.configure do |config|
      # ... other code
    
      config.after(:suite) do
        ActiveRecord::Base.connection.execute("DEALLOCATE ALL")
      end
    
      # ... other code
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're evaluating MySQL and PostgreSQL for building our indic language(using utf-8 encoding) web application
we are running java6/hibernate/c3p0/postgresql stack. Our JDBC Driver is 8.4-701.jdbc3 I have a few
I have this query using PostgreSQL 9.1 (9.2 as soon as our hosting platform
So our project use PostgreSQL database and we use JPA for operating the database.
When executing batch queries via JDBC to pgbouncer, I get the following error: org.postgresql.util.PSQLException:
In our project (which is fully developed using .NET), we use a medium sized
In our project we need to import the csv file to postgres. There are
I'm migrating our model to postgresql for the FTS and data integrity update myschema.counters
I'm using JDBC to connect to a PostgreSQL database. We are trying to block
We are currently shifting from using PostgreSQL installed on remote CentOS boxes to using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.