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


From: Euler Taveira de Oliveira <eulerto(at)yahoo(dot)com(dot)br>
To: Neil Conway <neilc(at)samurai(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>,eulerto(at)yahoo(dot)com(dot)br
Subject: Re: DELETE ... USING
Date: 2005-04-05 02:15:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-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;
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;

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

Yahoo! Acesso Grátis - Internet rápida e grátis. 
Instale o discador agora!

In response to


pgsql-hackers by date

Next:From: Greg Sabino MullaneDate: 2005-04-05 02:46:18
Subject: Re: [GENERAL] plPHP in core?
Previous:From: Tom LaneDate: 2005-04-05 02:06:12
Subject: Re: [HACKERS] plPHP in core?

pgsql-patches by date

Next:From: Neil ConwayDate: 2005-04-05 02:49:19
Subject: Re: DELETE ... USING
Previous:From: Tom LaneDate: 2005-04-05 02:04:06
Subject: Re: avg(int2) and avg(int8) micro-opt

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