From: | Benedict Holland <benedict(dot)m(dot)holland(at)gmail(dot)com> |
---|---|
To: | Rob Sargent <robjsargent(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Input validation |
Date: | 2019-08-07 21:38:16 |
Message-ID: | CAD+mzozGPPGOL-z=3vSEHfHRGY7pt9x1fYT+DzFNDNFozjDkUw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I think a check will also work but I second triggers.
Thanks,
~Ben
On Wed, Aug 7, 2019, 2:21 PM Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>
> On 8/7/19 12:07 PM, stan wrote:
> > Have table that contains employee keys, paired up with work type keys
> > (both foreign keys) and a 3rd column that you enter a billing rate in.
> > Then I have a table where employees enter their work. I need to
> validate
> > that the employee, work type pair exists, before allowing the new
> record
> > to be inserted.
> >
> > Any thoughts as to good way to do this?
> >
> >
> Does the employee interactively specify the "work type" then some
> time-spent value?
>
> Can the work-type be chosen from a drop-down generated by
>
> select work_type from table where employee = <current user>
>
> Otherwise you'll need a trigger on the insert into "enter their work"
> table. Sad thing here is the user has likely left the scene.
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Igal @ Lucee.org | 2019-08-07 22:54:33 | Re: How to check if a field exists in NEW in trigger |
Previous Message | Benedict Holland | 2019-08-07 21:36:34 | Re: Why must AUTOCOMMIT be ON to do txn control in plpgsql procedure? |