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

Add support for PG_DIAG_*_NAME error fields #161

Closed
ged opened this issue May 13, 2013 · 6 comments
Closed

Add support for PG_DIAG_*_NAME error fields #161

ged opened this issue May 13, 2013 · 6 comments

Comments

@ged
Copy link
Owner

ged commented May 13, 2013

Original report by Joe Van Dyk (Bitbucket: joevandyk, GitHub: joevandyk).


See related discussion here: http://psycopg.lighthouseapp.com/projects/62710/tickets/149

http://www.postgresql.org/docs/devel/static/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD

@ged
Copy link
Owner Author

ged commented May 13, 2013

Original comment by Lars Kanis (Bitbucket: larskanis, GitHub: larskanis).


Thanks for the pointer. I'll add the new constants.

@ged
Copy link
Owner Author

ged commented May 13, 2013

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


This looks awesome. I wonder if we could use the new constants in conjunction with the implementation of #5 to do something like they did with Psycopg?

@ged
Copy link
Owner Author

ged commented May 13, 2013

@ged
Copy link
Owner Author

ged commented May 13, 2013

Original comment by masklinn (Bitbucket: masklinn, GitHub: masklinn).


@ged psycopg doesn't really use the #5 thing for diagnostics, they added a new attribute to the root Psycopg exception, and that attribute links to an object bearing all diagnostic attributes. It's not limited to any specific kind of error.

Although it is related to having a root exception type for the adapter, I don't know if pg has one.

@ged
Copy link
Owner Author

ged commented May 13, 2013

Original comment by Lars Kanis (Bitbucket: larskanis, GitHub: larskanis).


The new PG_DIAG_*_NAME error fields IMHO don't help in regards to issue #5. But psycopg does already proper subclassing of exceptions that is described in #5. It's realized through errorcodes.py which is parsed and autogenerated from the postgresql.org documentation. We might adopt some ideas (although I would like parsing from postgresql/src/backend/utils/errorcodes.txt more).

Regarding to the PG_DIAG_*_NAME error fields, no further changes are needed. We already have this link to the result object, which can be used to retrieve the PG_DIAG_* fields.

@ged
Copy link
Owner Author

ged commented May 14, 2013

Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).


Add support for PG_DIAG_*_NAME error fields.

This fixes issue #161 .

@ged ged closed this as completed May 14, 2013
@ged ged added this to the Pending milestone Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant