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

Return message from Postgres when there's a validation during datastore import #4583

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

amercader
Copy link
Member

Right now when there's a validation error during datastore_create you just get a generic message with no actual details (eg wrong type or wrong values). At least let's return Postgres message which gives the column and/or the wrong value.

eg in my case it went from this:

The data was invalid (for example: a numeric value is out of range or was inserted into a text field)

To this:

The data was invalid: invalid input syntax for type numeric: "SAN29"

Right now when there's a validation error during datastore_create you
just get a generic message with no actual details (eg wrong type or
wrong values). At least let's return Postgres message which gives the
column and/or the wrong value.
@wardi
Copy link
Contributor

wardi commented Dec 10, 2018

I'm working on some code adjacent to this so I'll merge now: I'm looking at a way to return a list of errors from datastore_create/upsert instead of just the first for validation failures written as triggers. So in ckan core at the API level I'll just be standardizing a way to return the column names along with the errors in each.

@wardi wardi merged commit 5ce4ae9 into master Dec 10, 2018
@smotornyuk smotornyuk deleted the better-datastore-validation-error branch December 19, 2018 15:38
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

Successfully merging this pull request may close these issues.

None yet

2 participants