Skip site navigation (1) Skip section navigation (2)

Re: Unable to Delete a Row

From: "Derrick Betts" <derrick(at)grifflink(dot)com>
To: "Kevin Crenshaw" <kcrenshaw(at)tiewireinc(dot)com>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Unable to Delete a Row
Date: 2005-05-25 16:43:30
Message-ID: 020e01c56148$e42b4df0$0202a8c0@main (view raw or flat)
Thread:
Lists: pgsql-novice
I think that you need to "RETURN NEW;" in your tg_remove_contact() function rather than "RETURN NULL;"

Derrick
  ----- Original Message ----- 
  From: Kevin Crenshaw 
  To: paul(at)entropia(dot)co(dot)uk ; pgsql-novice(at)postgresql(dot)org 
  Sent: Wednesday, May 25, 2005 10:16 AM
  Subject: Re: [NOVICE] Unable to Delete a Row


  Paul,

   

  Thanks for responding.  I tried your suggestion and it didn't work.  However, I found that when I removed a trigger from the contacts table, the deletion completed successfully.  Here is the text for the trigger function:

   

  CREATE OR REPLACE FUNCTION tg_remove_contact() RETURNS TRIGGER AS $$

        BEGIN

              UPDATE synchronization SET db_updated = current_timestamp, action = 'exch_del'

                    WHERE OLD.contactid = synchronization.contactid;

        RETURN NULL;

        END;

  $$ LANGUAGE 'plpgsql';

   

  CREATE TRIGGER tg_del_contact BEFORE DELETE

        ON contacts

        FOR EACH ROW

        EXECUTE PROCEDURE tg_remove_contact();

   

  Do you know why this trigger would prevent me from deleting a row from the contacts table?

   

  Thanks!

   

   

  kevin crenshaw

   

   


------------------------------------------------------------------------------

  From: paul(at)entropia(dot)co(dot)uk [mailto:paul(at)entropia(dot)co(dot)uk] 
  Sent: Wednesday, May 25, 2005 10:32 AM
  To: pgsql-novice(at)postgresql(dot)org
  Subject: Re: [NOVICE] Unable to Delete a Row

   

  Try:

  DELETE FROM CONTACTS WHERE CONTACTID = '853';

   

  > 

  > I am running Postgres v8.0.1 on Win XP Pro. When I try to delete a record, which I know exists, 

  > I simply get ~DELETE 0T as a response. Please Help!

  > 

  > Here is a little more info:

  > 

  > DELETE FROM CONTACTS WHERE CONTACTID = 853;

  > 

  > Query returned successfully: 0 rows affected, 62 ms execution time.

  > -- Executing query:

  > Select * from contacts where contactid = 853;

  > 

  > 

  > Total query runtime: 15 ms.

  > Data retrieval runtime: 16 ms.

  > 1 rows retrieved.

  > 

  > -- Executing query:

  > EXPLAIN ANALYSE Delete from contacts where contactid = 853;

  > 

  > 

  > Total query runtime: 63 ms.

  > Data retrieval runtime: 0 ms.

  > 3 rows retrieved.

  > 

  > Thanks in advance

  > 

  > kevin crenshaw

  > 

  > 

   

In response to

Responses

pgsql-novice by date

Next:From: Steve TucknottDate: 2005-05-25 16:44:43
Subject: Re: Unable to Delete a Row
Previous:From: Kevin CrenshawDate: 2005-05-25 16:16:15
Subject: Re: Unable to Delete a Row

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group