File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes Unable to delete post: error SQL null value in column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JForum
Bookmark "Unable to delete post: error SQL null value in column "log_id"" Watch "Unable to delete post: error SQL null value in column "log_id"" New topic
Author

Unable to delete post: error SQL null value in column "log_id"

sebastien maye
Greenhorn

Joined: Sep 26, 2013
Posts: 5
Hi,

I'm facing a problem when i try to delete a posts with an admin user. Jform send me the following error message:
org.postgresql.util.PSQLException: ERROR: null value in column "log_id" violates not-null constraint
Détail : Failing row contains (null, 13, dd, réponse de test, 2013-09-26 16:57:06.129, 1, 49485, 0, 69).
I'm using Jforum 2.3.3 with Postgres 9 and all i know is that the fisrt field, which is null, is the result of a sequence "jforum_categories_seq".
The sequence works fine, the number returned is correct, so I can't figure how the insert in the "jforum_moderation_log" contains a null value.

Can somebody helps me ? Thanks in advance !

Smile
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30512
    
150

Sebastien,
Welcome to CodeRanch!

log_id is the primary key for that table and set using a sequence (or the like depending on your database). It shouldn't be possible for it to be null. Is it possible you are running a database type set that doesn't match your actual database?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
sebastien maye
Greenhorn

Joined: Sep 26, 2013
Posts: 5
Thanks for the warm welcome and the quick answer !

The thing is that all the others features, and most of them use sequence, work fine: create posts, users, replies...
At first i though about a data problem cause the content of the database is the result of a migration from an Oracle Database, but i can't see how it could be related to my problem.
Could you be a bit more specific about the "type set" ? Is there some sort of incompatibility between Postgres and Jforum ?

thanks again.

Smile

Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30512
    
150

I was thinking of the following lines in SystemGlobals.properties. In particular, I was wondering if maybe it didn't match your database name. We are using postgres so there certainly isn't a fundamental incompatibility!


Data migration does raise a good point. Do you have any nulls in the log_id field now? And can you double check the database has the sequence set on the jforum_moderation_log table. I'm wondering if the key or constraint got dropped somehow.
sebastien maye
Greenhorn

Joined: Sep 26, 2013
Posts: 5
I am double checking the facts. Here is some more informations:
Jforum's version: "Powered by JForum 2.3.3"
Postgres' version:

The content of the SystemGlobal.properties

The content of the jforum_moderation_log table, in which there is no null value in the column "log_id", the constraint is well inforced (CONSTRAINT jforum_moderation_log_pkey PRIMARY KEY (log_id)).

The sequence which working fine:


I was wondering, can it be a problem caused by the jdbc drivers ? We're using in the glassfish's lib directory "postgresql-9.1-902.jdbc4.jar".
Also, i deleted with SQL requests, thousands of anonymous posts from bots, can i broke something doing so ?

Gratefully,

Smile
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10100
    
164

You can do a quick check on the DB side. Just fire a valid insert query to that table from an SQL editor and see if the column gets an auto generated value from the sequence. If that works, then it's something on the JForum integration side that's wrong.

[My Blog] [JavaRanch Journal]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41817
    
  62
Has this ever worked, or is it a new phenomenon?


Ping & DNS - my free Android networking tools app
sebastien maye
Greenhorn

Joined: Sep 26, 2013
Posts: 5
Thanks all for your trails !
After trying to insert into this table, I received:

The table jforum_moderation_log is defined as follow in our database:

Whereas the update script from 2.1.7 to 2.1.8 states:

Seems like the migration was half done...

Thanks again !!

Smile
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41817
    
  62
Be aware that JForum 2.1.* (the last version by the original developer) is a different beast than JForum 2.3.* (a fork that is hosted at Google Code). While care was taken to maintain compatibility, you may not be able to transfer DBs between the two versions without further work.
sebastien maye
Greenhorn

Joined: Sep 26, 2013
Posts: 5
Roger.

I'll keep that in mind =)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to delete post: error SQL null value in column "log_id"