Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:35:35+00:00 2026-06-14T09:35:35+00:00

We are migrating to postgresql database and we want to use as many constraint

  • 0

We are migrating to postgresql database and we want to use as many constraint checks as possible. The problem is when I want to validate web forms there is a lot of duplicate code which is hard to maintain. Is it possible to use this database checks also for web forms validation? The application is written in PHP and the database layer is pomm. The goal is just to grab all filled values, send it to database and get all failed constraints without defining additional rules in PHP application. How can I achive that the simplest way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:35:36+00:00Added an answer on June 14, 2026 at 9:35 am

    Well, database constraints are here to ensure your data are stored in a consistent manner. Form validation might have different rules depending on the functionnal context. Imho it is not a good idea to rely on database constraints to validate forms (I use the Symfony validator component for that).

    From a purely technical point of view, if you want to use the database as validation layer, the hardest part is to extract why data could not be inserted / updated. Even if you could get this information from the Exception message, this will validate fields one by one until all fields are ok.

    If you still want to go with it, catch the Pomm\Exception thrown and get the SQL error code from it.

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're currently migrating our database back-end from Firebird to PostgreSQL. We use NHibernate as
I am migrating to Postgresql, but I am facing a problem. A trick I
I'm migrating from MySQL to PostgreSQL and I would like to use some advanced
I'm migrating my MySQL databases to PostgreSQL. While connecting database to my Python script
I'm having some trouble with a django database (postgresql backend).There was a model (a
I'm migrating a database from sqlite3 to postgres and am wondering if there are
I am migrating from a test SQLite database to a PostgreSQL database. I have
I was migrating mysql database to postgres and stumbled across the following block in
Newbie question about PostgreSQL. I'm migrating a MySQL/PHP app I've created, hosted on a
Migrating a legacy application from WebSphere v.6 to WebSphere v.8. The application's web.xml only

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.