Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 8947 invoked from network); 14 Jul 2010 22:15:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Jul 2010 22:15:18 -0000 Received: (qmail 48396 invoked by uid 500); 14 Jul 2010 22:15:18 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 47713 invoked by uid 500); 14 Jul 2010 22:15:17 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 47468 invoked by uid 99); 14 Jul 2010 22:15:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jul 2010 22:15:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jul 2010 22:15:14 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o6EMEqvm011544 for ; Wed, 14 Jul 2010 22:14:52 GMT Message-ID: <9720118.384821279145692744.JavaMail.jira@thor> Date: Wed, 14 Jul 2010 18:14:52 -0400 (EDT) From: "Rick Curtis (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1698) SchemaAction=deleteTableContents throws error if table doesn't exist In-Reply-To: <4609691.63691276360813140.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888571#action_12888571 ] Rick Curtis commented on OPENJPA-1698: -------------------------------------- I was looked at the postgres docs[1] and it appears that "IF EXISTS" isn't valid for the "DELETE" command. I don't have postgres setup for unit tests yet so I haven't been able to play with this too much yet. Can you post the entire stack trace for the exception that you're hitting? [1] http://www.postgresql.org/docs/current/static/sql-delete.html > SchemaAction=deleteTableContents throws error if table doesn't exist > -------------------------------------------------------------------- > > Key: OPENJPA-1698 > URL: https://issues.apache.org/jira/browse/OPENJPA-1698 > Project: OpenJPA > Issue Type: Bug > Components: jdbc > Affects Versions: 2.0.0 > Environment: Win XP, Postgres 8.4, OpenJPA 2.0.0 > Reporter: Oliver Bayer > > Hi, > I want to set up my project during development so that all table contents are deleted with the following property in persistence.xml: > > If I start up with an empty database I get the following error: > org.apache.openjpa.persistence.PersistenceException: ERROR: Relation >>openjpa_sequence_table<< doesn't exist. > This error is raised because of the following sql statement: DELETE FROM OPENJPA_SEQUENCE_TABLE. > My suggested solution would be to modify DBDictionary.getDeleteTableContentsSQL so that it only deletes content from a table if the table exists. > DBDictionary: Line 2183 > --------------------------------- > change: deleteSQL.add("DELETE FROM " + toDBName(tables[i].getFullIdentifier())); > to: deleteSQL.add("DELETE FROM " + toDBName(tables[i].getFullIdentifier()) + " IF EXISTS"); > What do you mean: Is this a valid bugfix? I'm looking forward to your responses. > Greets Oli -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.