Re: DELETE ... USING

Поиск
Список
Период
Сортировка
От Euler Taveira de Oliveira
Тема Re: DELETE ... USING
Дата
Msg-id 20050405021504.57497.qmail@web54607.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: DELETE ... USING  (Neil Conway <neilc@samurai.com>)
Ответы Re: DELETE ... USING  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
Hi Neil,


> > BTW, this patch is lacking ruleutils.c support.  Put a DELETE USING
> > into a rule and see whether pg_dump will dump the rule correctly
> ...
>
> Good catch; a revised patch is attached.
>
Greate job. But I'm worried about add_missing_from enabled. See:

euler=# delete from t3 using t1 where b > 500;
DELETE 4
euler=# select * from t3;
 x | y
---+---
(0 rows)

In this case, I 'forget' to do the join and it delete all rows from t3.
I know that user needs to pay attention, but ... What about default
add_missing_from to off?

The other case is:

euler=# select * from t1 where t1.a = t3.x;
NOTICE:  adding missing FROM-clause entry for table "t3"
NOTICE:  adding missing FROM-clause entry for table "t3"
 a | b
---+----
 5 | 10
(1 row)

euler=# delete from t1 where t1.a = t3.x;
DELETE 1
euler=#

I think we need at least a NOTICE here. Of course it could be extended
to UPDATE too.

BTW, what about regression tests for UPDATE ... FROM?

PS> all examples are extracted from regression database.



Euler Taveira de Oliveira
euler[at]yahoo_com_br





Yahoo! Acesso Grátis - Internet rápida e grátis.
Instale o discador agora! http://br.acesso.yahoo.com/

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: avg(int2) and avg(int8) micro-opt
Следующее
От: Neil Conway
Дата:
Сообщение: Re: DELETE ... USING