Re: Delete statement does not work with PostgreSQL 8.0.1

Lists: pgsql-general
From: Ledina Hido <lh1101(at)ecs(dot)soton(dot)ac(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Delete statement does not work with PostgreSQL 8.0.1
Date: 2005-11-24 01:54:43
Message-ID: 0A06BA4A-CB42-4557-8137-8B65499D2A10@ecs.soton.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi,

I have just today installed the new version of PostgreSQL (8.1.0),
and my old code seems to have stopped working.

I am basically trying to delete a row from a table:

DELETE FROM "CON" WHERE "ref"='CON5';

I have checked and CON5 is definitively in the CON table. I tried
using JDBC, pgAdminIII and command line but it doesn't seem to work.
I get a message saying 0 rows have been affected, as if the item was
not in the table. Am I doing something wrong? Has the syntax changed
or is this just a bug?

Thanks for your help,
Ledina


From: Richard Huxton <dev(at)archonet(dot)com>
To: Ledina Hido <lh1101(at)ecs(dot)soton(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Delete statement does not work with PostgreSQL 8.0.1
Date: 2005-11-24 08:22:02
Message-ID: 4385782A.30200@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Ledina Hido wrote:
> Hi,
>
> I have just today installed the new version of PostgreSQL (8.1.0), and
> my old code seems to have stopped working.
>
> I am basically trying to delete a row from a table:
>
> DELETE FROM "CON" WHERE "ref"='CON5';
>
> I have checked and CON5 is definitively in the CON table. I tried using
> JDBC, pgAdminIII and command line but it doesn't seem to work. I get a
> message saying 0 rows have been affected, as if the item was not in the
> table. Am I doing something wrong? Has the syntax changed or is this
> just a bug?

Well, if DELETE had stopped working then 8.1 would never have been
released, so there's something more subtle going on.

1. What happens if you run SELECT * FROM "CON" WHERE "ref"='CON5';
2. What does an "explain analyse" show for that?
3. If it's using an index try: SET enable_indexscan=false; then run
query 1 again.

--
Richard Huxton
Archonet Ltd


From: Ledina Hido <lh1101(at)ecs(dot)soton(dot)ac(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Delete statement does not work with PostgreSQL 8.0.1
Date: 2005-11-24 09:24:46
Message-ID: 13F5AE42-6EF0-4FDB-AB62-120C1E4AD831@ecs.soton.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi guys,

Thanks for you suggestions.

After a long night I found out what the problem was. I had a trigger
for deletes on table CON, and the trigger returned NEW at the end
instead of OLD.

Thanks again,
Ledina

PS I didn't really think 8.1 delete had stopped working. It was just
far too early in the morning.

On 24 Nov 2005, at 08:22, Richard Huxton wrote:

> Ledina Hido wrote:
>> Hi,
>> I have just today installed the new version of PostgreSQL (8.1.0),
>> and my old code seems to have stopped working.
>> I am basically trying to delete a row from a table:
>> DELETE FROM "CON" WHERE "ref"='CON5';
>> I have checked and CON5 is definitively in the CON table. I tried
>> using JDBC, pgAdminIII and command line but it doesn't seem to
>> work. I get a message saying 0 rows have been affected, as if the
>> item was not in the table. Am I doing something wrong? Has the
>> syntax changed or is this just a bug?
>
> Well, if DELETE had stopped working then 8.1 would never have been
> released, so there's something more subtle going on.
>
> 1. What happens if you run SELECT * FROM "CON" WHERE "ref"='CON5';
> 2. What does an "explain analyse" show for that?
> 3. If it's using an index try: SET enable_indexscan=false; then run
> query 1 again.
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match