Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PostgreSQL integration] CreateNote needs to generate and persist unique ID #332

Open
aysylu opened this issue Jun 24, 2019 · 4 comments
Open
Labels
bug good first issue Get started with contributing to Grafeas! help wanted

Comments

@aysylu
Copy link
Contributor

aysylu commented Jun 24, 2019

Expected Behavior

On CreateNote(), a unique ID is generated and persisted for each Note.

Actual Behavior

The ID field is null.

Steps to Reproduce the Problem

Bring up Grafeas with PostgreSQL described in grafeas-pgsql, and try to insert an occurrence. See instructions on how to create them.

Additional info

From local PostgreSQL logs:

Postdb_1      | 2019-06-24 20:34:59.765 UTC [72] ERROR:  null value in column "note_id" violates not-null constraint
db_1      | 2019-06-24 20:34:59.765 UTC [72] DETAIL:  Failing row contains (1, occurrence_example, test, name: "projects/occurrence_example/occurrences/test"
db_1      | 	resource: <..., null).
db_1      | 2019-06-24 20:34:59.765 UTC [72] STATEMENT:  INSERT INTO occurrences(project_name, occurrence_name, note_id, data)
db_1      | 	                      VALUES ($1, $2, (SELECT id FROM notes WHERE project_name = $3 AND note_name = $4), $5)
server_1  | 2019/06/24 20:34:59 Failed to insert Occurrence in database pq: null value in column "note_id" violates not-null constraint
server_1  | 2019/06/24 20:54:03 Failed to insert Occurrence in database pq: null value in column "note_id" violates not-null constraint
db_1      | 2019-06-24 20:54:03.541 UTC [71] ERROR:  null value in column "note_id" violates not-null constraint
@aysylu aysylu added good first issue Get started with contributing to Grafeas! help wanted bug labels Jun 24, 2019
@vtsao
Copy link
Contributor

vtsao commented Jun 25, 2019

CreateNote should not generate IDs, the create note request from the API def requires the user specify an ID for the note. Occurrences on the other hand, have their IDs generated.

@aysylu
Copy link
Contributor Author

aysylu commented Jun 25, 2019

This is about an internal ID column that's generated and used for indexing in PG.

@VishalVinayRam
Copy link

I would like to work on it

@aysylu
Copy link
Contributor Author

aysylu commented Dec 6, 2021

@VishalVinayRam ok great! Please send the PR to the maintainers team when ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Get started with contributing to Grafeas! help wanted
Projects
None yet
Development

No branches or pull requests

3 participants