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
gt;
> > -Original Message-
> > From: pgsql-general-ow...@postgresql.org
> > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Leif Jensen
> > Sent: Freitag, 18. September 2015 10:23
> > To: pgsql-general
> > Subject: [GENERAL] Delete trigger
> >
&g
.@postgresql.org
> [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Leif Jensen
> Sent: Freitag, 18. September 2015 10:23
> To: pgsql-general
> Subject: [GENERAL] Delete trigger
>
>Hi,
>
>I am running PostgreSQL 9.3.4. I have a simple table with 3 fields:
>
> CR
Hi,
I am running PostgreSQL 9.3.4. I have a simple table with 3 fields:
CREATE TABLE devicegroup (
groupid integer NOT NULL,
ctrlid integer NOT NULL,
userid integer NOT NULL
);
ALTER TABLE ONLY devicegroup
ADD CONSTRAINT pk_devicegroup PRIMARY KEY (groupid, ctrlid, userid);
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 "
Hello everyone,
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 "TABLE";
RETU
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
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.
The is no explicit link between the tables, so I can't do 'DELETE CASCADE'
or anything like that
How do I get the values of parameters in the query?
e.g.
where x = 'op';
i.e. How do I get ?
field: x
value : op
any example, pointers will help.
thanks,
Sandeep Joshi
15 matches
Mail list logo