[Tickets #9638] Re: null value in column rule_id with postgresql

bugs at horde.org bugs at horde.org
Wed Mar 9 16:04:17 UTC 2011


BITTE NICHT AUF DIESE NACHRICHT ANTWORTEN. NACHRICHTEN AN DIESE  
E-MAIL-ADRESSE WERDEN NICHT GELESEN.

Ticket-URL: http://bugs.horde.org/ticket/9638
------------------------------------------------------------------------------
  Ticket           | 9638
  Aktualisiert Von | michael.menge at zdv.uni-tuebingen.de
  Zusammenfassung  | null value in column rule_id with postgresql
  Warteschlange    | Ingo
  Version          | Git master
  Typ              | Bug
  Status           | Assigned
  Priorität        | 2. Medium
  Milestone        | 4.0
  Patch            |
  Zuständige       | Horde Developers, Chuck Hagenbuch
------------------------------------------------------------------------------


michael.menge at zdv.uni-tuebingen.de (2011-03-09 16:04) hat geschrieben:

> 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);







More information about the bugs mailing list