On Fri, Jun 10, 2016 at 1:47 PM, Steve Atkins <steve@xxxxxxxxxxx> wrote:
You could name the check constraints, catch the errors and use a client-side mapping between constraint name and a friendly error message for display in the web interface.
This seems plausible, but not ideal. I could get over the aesthetics of sequence gaps, but don't like throwing lots of database errors on principle, and also for silting up my logs. Seems better to catch these before submitting.
You could implement the checks in PHP in the database. https://public.commandprompt.com/projects/plphp/wiki
I'm aiming as much as possible for this to "just work" with standard Postgres, and this approach gets away from that. Plus people would have to know SQL AND PHP in order to create tables.
You could look at one of the existing SQL parsers implemented in PHP, and use those to parse the constraint to a tree from which you could easily pull PHP.
This one sounds most promising! I took a quick Google, and it looks like there are lots of them, and a heavy Mysql focus. Anyone have experience or suggestions about which of these might be best, and particularly for Postgres?
Thanks for the suggestions!
Ken
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
AGENCY Software
A Free Software data system
By and for non-profits
(253) 245-3801
learn more about AGENCY or
follow the discussion.