Hi Ioana and David.
Thank you. Yes, I can see the problem. I will look into your suggestions.
Leif
- Original Message -
> On Friday, September 18, 2015, Leif Jensen wrote:
>
> >Hello Laurenz,
> >
> >Thank you for you suggestion. I really want to aviod that someone
> > '
On Friday, September 18, 2015, Leif Jensen wrote:
>Hello Laurenz,
>
>Thank you for you suggestion. I really want to aviod that someone
> 'accidentally' deletes too much by typing (programming) a not full
> qualified DELETE ... statement. In your case one would have to always use
> the del
It depends on the size of the table and the frequency of updates, deletes
but cold consider an audit table with triggers for update, delete and
truncate. At least you have a way to recover deleted records.
Ioana
On Fri, Sep 18, 2015 at 5:52 AM, Leif Jensen wrote:
>Hello Laurenz,
>
>Tha
Hello Laurenz,
Thank you for you suggestion. I really want to aviod that someone
'accidentally' deletes too much by typing (programming) a not full qualified
DELETE ... statement. In your case one would have to always use the delete
function, but no restrictions on using the DELETE statem
Leif Jensen wrote:
>If I do "DELETE FROM devicegroup WHERE group=1" I do not want to delete
> anything. I only want to
> delete if I do "DELETE FROM devicegroup WHERE groupid=x AND ctrlid=y AND
> userid=z". I don't wanna let
> anyone delete more than 1 row at a time.
I can't think of a way t
Hi Charles,
If I do "DELETE FROM devicegroup WHERE group=1" I do not want to delete
anything. I only want to delete if I do "DELETE FROM devicegroup WHERE
groupid=x AND ctrlid=y AND userid=z". I don't wanna let anyone delete more than
1 row at a time.
Leif
- Original Message -
Hello
Not sure I get it right, but all three fields are not nullable. So they will
always have a value, which is what I understand of "are specified".
What do you need the trigger for in that case?
Bye
Charles
> -Original Message-
> From: pgsql-general-ow...@postgresql.org
> [mailto:pg
On 27 May 2014 12:25, Yvonne Zannoun
wrote:
> CREATE OR REPLACE FUNCTION delete_records()
> RETURNS TRIGGER AS $$
> BEGIN
> delete from "TABLE";
> RETURN NEW;
> END;
> $$
> LANGUAGE plpgsql;
You can't return NEW in an ON DELETE trigger - there is no NEW record.
Since you're going with a STATE
Thank you very much, that answers my question.
And yes, I think you are right with the FOR EACH ROW/STATEMENT, I didn't
think that through for this example.
Thank you for your help!
Kind regards,
*Yvonne Zannoun*
Graduate Technical Consultant
Snowflake Software
*Tel: +44 (0) 23 80238 232*
Emai
Yvonne Zannoun wrote:
> I have this question regarding delete triggers and how it affects data
> integrity.
> So here goes: I have this trigger which deletes everything before I insert
> new rows.
>
> CREATE OR REPLACE FUNCTION delete_records()
> RETURNS TRIGGER AS $$
> BEGIN
> delete from "
Chris Berry writes:
> When I update, insert or delete to one table, I need a trigger to delete and
> possibly insert into another table. The trigger I have works for insert and
> update, but returns an error when I do a delete.
There's no "NEW" row in a delete trigger (... and the error message
s
11 matches
Mail list logo