Re: Help with DELETE statement via ODBC

From: "Steve Lutz" <slutz(at)HighBeam(dot)com>
To: "Carlos Abalde" <carlos(at)lfcia(dot)org>, <pgsql-odbc(at)postgresql(dot)org>
Cc: Håkon Clausen <hakonhc(at)nospam(dot)hclausen(dot)net>
Subject: Re: Help with DELETE statement via ODBC
Date: 2004-06-08 00:03:31
Message-ID: D774C5E2898B2A48A2C3BC83218E9E0835223A@kopmail.alacritude.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

If we are going to turn this into a Philosophical discussion, what
happens when a select statement updates zero rows? It doesn't cause an
error, why does a delete?

-----Original Message-----
From: Carlos Abalde [mailto:carlos(at)lfcia(dot)org]
Sent: Monday, June 07, 2004 4:14 PM
To: pgsql-odbc(at)postgresql(dot)org
Cc: Håkon Clausen
Subject: Re: [ODBC] Help with DELETE statement via ODBC

Håkon Clausen wrote...

> Hi Carlos,
>
> This is the correct behavior. Deleting 0 rows will give an ODBC error.
> You will have to rewrite your query so that this does not occur.

Hi Håkon,

I'm not an expert on ODBC and maybe this is and philosophical
discussion, buy I think that DELETE querys are very usual in
DB applications, and querys like,

DELETE FROM table WHERE field = foreign_key

that are very common when you are working with 1-N relations,
need a normal behaviour when 0 rows are deleted.

For example,

+---------+ 1 N +-----------+
| Formula |----------------| Parameter |
+---------+ +-----------+
for_key par_key
for_txt par_for (foreign key)
... par_nam
par_val
...

Represents a formula with several parameters. If we have a
new list of parameters for a existing formula, the best way to update
then is to delete the old parameters and create the new ones.
With the current DELETE behaviour, the normal case of a
formula without parameters must be considered as a special
case!

I think that there is a lot of examples like this in DB aplications.
Moreover, as DBs are highly related with Set Theory, it's an error the
current behaviour, because the empty set is dealed as a special case.

These are the mains reasons I think the current behaviour is erroneus.
However, as I said before, maybe this is a philosophical discussion :).

Best regards,

+---.---.---.---.---.---.---.---.---+---.---.---.---.---.---.---.---+
| Carlos Abalde (carlos(at)lfcia(dot)org) | http://www.lfcia.org/~carlos |
+ LFCIA Lab, Dept. Computer Science | +34.981.167000 ext. 1275 +
| University of A Coruna, Spain | PGP Key ID = 0x04DF0EAF |
+-.---.---.---.---.---.---.---.---.-+-.---.---.---.---.---.---.---.-+

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Carlos Abalde 2004-06-08 07:54:10 Re: Help with DELETE statement via ODBC
Previous Message Nick Texidor 2004-06-07 22:34:18 Re: Help with DELETE statement via ODBC