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

  • Home
  • SEARCH
  • 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 6245777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:34:02+00:00 2026-05-24T12:34:02+00:00

I am doing an SQL transaction from kohana 3.2 framework in PHP with Postgresql

  • 0

I am doing an SQL transaction from kohana 3.2 framework in PHP with Postgresql 9.0

I get an exception

Database_Exception [ 0 ]: ERROR: current transaction is aborted,
commands ignored until end of transaction block [ SELECT c.* FROM
contents c WHERE c.content_id = 129 AND EXISTS( SELECT NULL FROM
contents tmp WHERE tmp.content_id = c.content_id AND c.content_id =
129 GROUP BY tmp.content_id HAVING MAX(tmp.version) = c.version ) ]

which i strange because this implies to me that some SQL prior to this one failed and thus no more SQL statements are being accepted. However I have all my SQL calls in a try/catch block and do a rollback on catch before rethrowing.

so i should never see this exception right?, Instead expect to see the one before, which would have spoiled the transaction to begin with…

I added logging to my PHP DB driver, and logged the following SQL statements leading up to the problem. The last SELECT statement below is the one referenced in my exception above.

The statement prior to the exception statement is an INSERT which would be a good candidate for the spoiler, however when i run all these statements by hand they all go thru properly.

UPDATE "articles" 
SET article_id = 126, title = 'abc', blurb = 'abc article blurb' 
WHERE "article_id" = 126 

SELECT c.* FROM contents c 
WHERE c.content_id = 127 
AND EXISTS( 
     SELECT NULL FROM contents tmp 
     WHERE tmp.content_id = c.content_id AND c.content_id = 127 
     GROUP BY tmp.content_id HAVING MAX(tmp.version) = c.version 
)

SELECT c.* FROM contents c 
WHERE c.content_id = 128 AND EXISTS( 
    SELECT NULL FROM contents tmp 
    WHERE tmp.content_id = c.content_id AND c.content_id = 128 
    GROUP BY tmp.content_id HAVING MAX(tmp.version) = c.version 
)

INSERT INTO "contents" 
("blurb", "content", "content_id", "content_type_id", "title", "author_id", "version", "editor_id") 
VALUES 
('postit art', 'FEATURE_IMG_david-chan-drawing_IMG_0221.JPG', 128, 2, 'david chan drawing', 5, 2, 4) 

 SELECT c.* FROM contents c 
 WHERE c.content_id = 129 AND EXISTS( 
     SELECT NULL FROM contents tmp 
     WHERE tmp.content_id = c.content_id AND c.content_id = 129 
     GROUP BY tmp.content_id HAVING MAX(tmp.version) = c.version 
 ) 

what is causing my transaction to abort ?

  • 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-05-24T12:34:03+00:00Added an answer on May 24, 2026 at 12:34 pm

    The PostgreSQL server itself will log errors in transactions, along with the SQL that caused them, that might help provide another end of the thread to get hold of?

    You might need to define a log_line_prefix to help you pick out your client if the database does a lot of different tasks (e.g. sth like log_line_prefix = '%t %c %q%u@%h:%d ')

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing some heavy lifting in an SQL database, from C#. I keep
Can I, instead of doing this via PHP, combine this in 1 sql statement?
I'm just wondering if there's a better way of doing this in SQL Server
I was doing some testing and straight LINQ-to-SQL queries run at least 80% faster
I wonder if it is possible to use KVC to generate SQL. I'm doing
When doing a cvs update , you get a nice summary of the state
Can I run a dynamic sql in a transaction and roll back using EXEC:
I have a SQL query that I'm currently solving by doing two queries. I
I'm doing using(var scope = new TransactionScope()) { //lots of calls to sql server
I'm doing some work that involves inserting a batch of records into a Sql

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.