Re: Converting Postgres SQL constraint logic to PHP?

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: rob stone <floriparob(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Converting Postgres SQL constraint logic to PHP?
Date: 2016-06-10 21:29:41
Message-ID: CAD3a31X7xE_6UxWwPS-sH2ewzWaCBuGy2P2m5sks8uqLmdaQWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jun 10, 2016 at 1:54 PM, rob stone <floriparob(at)gmail(dot)com> wrote:

>
> Hi Ken,
>
> Would this be static or dynamic?
> For example, if you altered a column to become defined as NOT NULL,
> say, when you build the form used to maintain that table you'd like to
> have a "required" attribute against the input field for that column. So
> if it were dynamic you'd have to access the database information_schema
> each time you wanted to send the HTML down the wire as well as when
> carrying out validation.
>

Hi Rob. I guess this is currently static, in that whenever you change the
tables you have to run an update process that rereads the tables and stores
the configuration information.

> Also, views are updateable and you'd have to check the tables and

columns making up the view.
>

Yeah. We're not using any updateable views at the moment, so for now I'd
be happy for this to work with tables. One step at a time! :)

> I've never used pg_meta_data but it might be helpful.
> Another thought would be to write a program that scanned all the tables
> in your database and wrote out a table in your application's schema
> where the table and column constraints were synthesised in a way
> suitable for use in PHP code.
>
> I'm not sure I'm following this one. Wouldn't such a program have to
parse the SQL and convert it to PHP anyway?

> Cheers,
> Rob
>

Thanks!

Ken

--
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://agency-software.org/demo/client
<https://agency-software.org/demo/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sridhar N Bamandlapally 2016-06-11 04:29:59 Re: [HACKERS] Online DW
Previous Message Ken Tanzer 2016-06-10 21:23:53 Re: Converting Postgres SQL constraint logic to PHP?