PHP Postgres constraint violation - can I get the constraint name somehow?

Posted by RnR on Stack Overflow See other posts from Stack Overflow or by RnR
Published on 2010-04-21T09:39:53Z Indexed on 2010/04/21 10:13 UTC
Read the original article Hit count: 150

We have a web application talking to a Postgres SQL database at work - I've set up many constraints on the server to keep data consistent but we have problems with reporting nicely what it is that prevents the user from entering his (invalid) data at a given moment.

The only thing we can get is "Constraint violation" but that isn't very descriptive, from perl or directly from PGAdmin we get nice info as to which constraint caused the failure (the constraint's name) - is there a way to do the same in PHP?

We're able to upgrade PHP or use a different db access module if it would help so I'm interested in knowing if it's possible to do using any way that you could safely recommend.

© Stack Overflow or respective owner

Related posts about php

Related posts about postgresql