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

Accessing query errors in a structured format. #46

Open
CrowdHailer opened this issue Mar 6, 2021 · 3 comments
Open

Accessing query errors in a structured format. #46

CrowdHailer opened this issue Mar 6, 2021 · 3 comments

Comments

@CrowdHailer
Copy link
Contributor

A sample of the possible reasons a query with PGO might fail.

"null value in column \"thread_id\" violates not-null constraint"
"column \"zz\" does not exist"
"relation \"moo\" does not exist"
** (exit) exited in: :pgo_pool.checkout(:defaultzz, [])
 ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its :"application isn't started"
{wrong_number_of_arguments,1,0}
{other,none_available} -> When the DB is down

Is there any level at which these errors are more structured. so that I can act on each type individually.

@tsloughter
Copy link
Collaborator

Pretty sure those first 3 are messages from postgres, right? So I don't think so. Unless there is a structured response for each error from postgres as part of the protocol, in which case we could have a structured response.

The other one is definitely wrong and needs to be updated.

@CrowdHailer
Copy link
Contributor Author

I think the first ones are from postgres. Though I wondered if that was the message field and if there was more metadata. Postgres defines error codes and I also found this code in pgo that looked like it was decoding errors in a more strucutred manner.

https://github.com/erleans/pgo/blob/master/src/pgo_protocol.erl#L494-L514
i.e. can you get the constraint from the constraint field.

@tsloughter
Copy link
Collaborator

Definitely would be nice to have structured errors. I don't know about getting the constraint from the constraint field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants