6.0.0-beta1
7/17/25

[#9638] null value in column rule_id with postgresql
Summary null value in column rule_id with postgresql
Queue Ingo
Queue Version Git master
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester michael.menge (at) zdv (dot) uni-tuebingen (dot) de
Created 03/09/2011 (5244 days ago)
Due
Updated 03/09/2011 (5244 days ago)
Assigned 03/09/2011 (5244 days ago)
Resolved 03/09/2011 (5244 days ago)
Github Issue Link
Github Pull Request
Milestone 4
Patch No

History
03/09/2011 05:42:47 PM Jan Schneider State ⇒ Resolved
 
03/09/2011 05:06:52 PM michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #12 Reply to this comment
Fixed
03/09/2011 04:18:38 PM Jan Schneider Comment #11
Assigned to Jan Schneider
Taken from Horde DevelopersHorde Developers
Taken from Chuck Hagenbuch
State ⇒ Feedback
Reply to this comment
How about this?
03/09/2011 04:18:17 PM Git Commit Comment #10 Reply to this comment
Changes have been made in Git for this ticket:

Fix creating new rules with PostgreSQL (Bug #9638).

  3 files changed, 4 insertions(+), 4 deletions(-)
http://git.horde.org/horde-git/-/commit/d8332264c0dcf55ffd522b99d5874ea2962754e2
03/09/2011 04:04:17 PM michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #9 Reply to this comment
I'm not a PostgreSQL expert, but this statement should enable 
autoincrementing on the rule_id column:
ALTER TABLE "ingo_rules" ALTER COLUMN "rule_id" SET DEFAULT 
NEXTVAL('ingo_rules_rule_id_seq')

No idea why it doesn't work.
The Postgress logs show that the following statement is executed

INSERT INTO ingo_rules (rule_id, rule_owner, rule_name, rule_action, 
rule_value, rule_fl
ags, rule_conditions, rule_combine, rule_stop, rule_active, 
rule_order) VALUES (NULL, 'zrsmm01', 'Whitelist', 9, NULL, NULL, NULL, 
NULL,
  NULL, 1, 1)

which fails as rule_id has not-null constraint. Omitting the columns 
with NULL vlaues or relpacing them with DEFAULT works

INSERT INTO ingo_rules (rule_owner, rule_name, rule_action, 
rule_active, rule_order) VALUES ('zrsmm01','Whitelist',9,1,1);

INSERT INTO ingo_rules (rule_id, rule_owner, rule_name, rule_action, 
rule_value, rule_flags, rule_conditions, rule_combine, rule_stop, 
rule_active, rule_order) VALUES 
(DEFAULT,'zrsmm01','Whitelist',9,DEFAULT,DEFAULT,DEFAULT,DEFAULT,DEFAULT,1,1);

03/09/2011 03:33:30 PM Jan Schneider Comment #8
Assigned to Chuck Hagenbuch
Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
Milestone ⇒ 4
Reply to this comment
I'm not a PostgreSQL expert, but this statement should enable 
autoincrementing on the rule_id column:
ALTER TABLE "ingo_rules" ALTER COLUMN "rule_id" SET DEFAULT 
NEXTVAL('ingo_rules_rule_id_seq')

No idea why it doesn't work.
03/09/2011 03:09:03 PM michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de New Attachment: db_migrate_ingo_debug.log Download
 
03/09/2011 02:36:53 PM Jan Schneider Comment #7 Reply to this comment
Please use the --debug flag to create db_migrate output.
03/09/2011 12:36:21 PM michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #6
New Attachment: ingo_exception.txt Download
Reply to this comment
Attached is the dump of the ingo_exception
03/09/2011 12:23:15 PM michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #5
New Attachment: db_migrate_ingo.log Download
Reply to this comment
Any chance you already did the migration a while ago?
A colleague and I did update the git version and the
database on an irregular basis, so I don't know when
at which time we did update the ingo schema.
The 2nd migration step didn't work correctly and has been fixed since. Try:

db_migrate ingo 1
db_migrate ingo
this did NOT solve the problem.

Attached is the output of
db_migrate ingo 1 and db_migrate ingo




03/09/2011 12:00:26 PM Jan Schneider Comment #4 Reply to this comment
Any chance you already did the migration a while ago? The 2nd 
migration step didn't work correctly and has been fixed since. Try:

db_migrate ingo 1
db_migrate ingo
03/09/2011 11:45:37 AM michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #3 Reply to this comment
Yes

./db_migrate ingo
[  INFO  ] Migrating DB up.
[  INFO  ] Current ingo schema version: 5
[  INFO  ] Ending ingo schema version: 5

03/09/2011 10:56:40 AM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Did you run the migrations?
03/09/2011 09:24:12 AM michael (dot) menge (at) zdv (dot) uni-tuebingen (dot) de Comment #1
Priority ⇒ 2. Medium
State ⇒ Unconfirmed
Patch ⇒ No
Milestone ⇒
Summary ⇒ null value in column rule_id with postgresql
Type ⇒ Bug
Queue ⇒ Ingo
Reply to this comment
Database: postgresql 8.4.2

clicking on Ingo results in the following error

2011-03-09T10:09:54+01:00 DEBUG: 1. require() horde/ingo/index.php:13
2. Ingo_Storage->retrieve() horde/ingo/filters.php:17
3. Ingo_Storage_Sql->_retrieve() horde/ingo/lib/Storage.php:138
4. Ingo_Storage_Filters_Sql->init() horde/ingo/lib/Storage/Sql.php:87
5. Ingo_Storage_Filters_Sql->addRule() 
horde/ingo/lib/Storage/Filters/Sql.php:74
6. Horde::errorHandler() horde/ingo/lib/Storage/Filters/Sql.php:140
2011-03-09T10:09:54+01:00 DEBUG: HORDE [ingo] SQL  (0,0012s)
2011-03-09T10:09:54+01:00 DEBUG: HORDE [ingo] SQL PK and serial 
sequence (0,0892s)
           AND dep.refobjid = 'ingo_rules'::regclass [pid 23310 on 
line 773 of 
"/home/zrssk01/horde/framework/Db/lib/Horde/Db/Adapter/Base.php"]
2011-03-09T10:09:54+01:00 DEBUG: HORDE [ingo] SQL PK and custom 
sequence (0,0602s)
           'ingo_rules'::regclass AND cons.contype = 'p' AND def.adsrc ~*
2011-03-09T10:09:55+01:00 ERR: HORDE [ingo] SQL QUERY FAILED: 
SQLSTATE[23502]: Not null violation: 7 ERROR:  null value in column 
"rule_id" violates not-null constraint
         INSERT INTO ingo_rules (rule_id, rule_owner, rule_name, rule_action,
2011-03-09T10:09:55+01:00 DEBUG: HORDE [ingo] SQL
         INSERT INTO ingo_rules (rule_id, rule_owner, rule_name, rule_action,
2011-03-09T10:09:55+01:00 EMERG: HORDE [ingo] SQLSTATE[23502]: Not 
null violation: 7 ERROR:  null value in column "rule_id" violates 
not-null constraint [pid 23310 on line 146 of 
"/home/zrssk01/horde/ingo/lib/Storage/Filters/Sql.php"]

Saved Queries