Error creating or updating a portfolio
Asked by Miguel Balbi:

When i try to create a portfolio i get the following error

![portfolio.PNG](/t5/image/serverpage/image-id/29479iD2DEFF3503C649E5/image-size/large?v=v2&px=999 "portfolio.PNG")

reading the logs (atlassian-jira.log)

![portfolio2.PNG](/t5/image/serverpage/image-id/29483i52E454B8BB8B3541/image-size/large?v=v2&px=999 "portfolio2.PNG")![portfolio3.PNG](/t5/image/serverpage/image-id/29484i511608E308B4746C/image-size/large?v=v2&px=999 "portfolio3.PNG")

Why my id will be arriving null to base data?


Answers:
author: JamieGeorgeson
body: Hey [@Miguel Balbi](/t5/user/viewprofilepage/user-id/579727), thanks for providing the relevant logs.

I can't reproduce this when creating a Program on my local instance.

It looks like we're trying to write a null value to the ID column in the program table. This is interesting because the ID column should be managed automatically by an auto-incrementing sequence in Postgres, we don't generate the ID value in the Portfolio code itself.

I suspect maybe Portfolio hasn't installed properly and the database schema has been left in an invalid state? Is this something that only started happening recently, or is this a new install that isn't working correctly? I'd like to check the start-up logs to make sure Portfolio has installed properly.

We should be able to see Portfolio initialise in the Jira start-up logs, it should look something like this:

```
[INFO] [talledLocalContainer] 2018-08-17 16:41:31,465 localhost-startStop-1 INFO [c.a.jira.startup.JiraStartupLogger]
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] ___ Plugin System Started _________________
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 2018-08-17 16:41:31,550 localhost-startStop-1 INFO [c.a.jira.upgrade.UpgradeScheduler] Scheduling upgrades to run in 1 minute(s)

...

[INFO] [talledLocalContainer] 2018-08-17 16:41:31,914 localhost-startStop-1 INFO [c.r.r.j.common.components.PortfolioAwesomeLauncher] =======================================
[INFO] [talledLocalContainer] 2018-08-17 16:41:31,914 localhost-startStop-1 INFO [c.r.r.j.common.components.PortfolioAwesomeLauncher] === Lauching Portfolio for Jira ... ===
[INFO] [talledLocalContainer] 2018-08-17 16:41:31,914 localhost-startStop-1 INFO [c.r.r.j.common.components.PortfolioAwesomeLauncher] =======================================

...

[INFO] [talledLocalContainer] 2018-08-17 16:41:32,335 localhost-startStop-1 INFO [c.a.r.c.b.jira.lifecycle.PluginStartUpTaskServiceBridge63] start up task 'Active Objects initialization' finished.
[INFO] [talledLocalContainer] 2018-08-17 16:41:32,335 localhost-startStop-1 INFO [c.a.r.c.plugin.lifecycle.PrimeDatabaseStartUpTask] Priming database

...
```

Are you able to find this section in your logs? Do you see any exceptions nearby?

On the database schema possibly being invalid, this is what that Program's table looks like for me locally:

```
jiradb=# \d+ "AO_D9132D_PROGRAM"
 Table "public.AO_D9132D_PROGRAM"
 Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------------+------------------------------------------------------------------+----------+--------------+-------------
 DESCRIPTION | text | | extended | |
 ID | bigint | not null default nextval('"AO_D9132D_PROGRAM_ID_seq"'::regclass) | plain | |
 OWNER | character varying(255) | | extended | |
 TITLE | character varying(255) | | extended | |
Indexes:
 "AO_D9132D_PROGRAM_pkey" PRIMARY KEY, btree ("ID")
Referenced by:
 TABLE ""AO_D9132D_PERMISSIONS"" CONSTRAINT "fk_ao_d9132d_permissions_program_id" FOREIGN KEY ("PROGRAM_ID") REFERENCES "AO_D9132D_PROGRAM"("ID")
 TABLE ""AO_D9132D_PROGRAM_CUSTOM_FIELD"" CONSTRAINT "fk_ao_d9132d_program_custom_field_program_id" FOREIGN KEY ("PROGRAM_ID") REFERENCES "AO_D9132D_PROGRAM"("ID")
```

The key part is:

```
?ID? ? ? ? ? | bigint? ? ? ? ? ? ? ? ?| not null default nextval('"AO_D9132D_PROGRAM_ID_seq"'::regclass)
```

Is it possible for you to connect to your own database and inspect the "AO_D9132D_PROGRAM" table to make sure your ID column has the same constraints?

Sorry I can't give you an answer for this right away, we need a bit more data to debug this properly.

Regards,

The Portfolio for Jira Team


Tags: advanced-roadmaps