pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem With A Rule
2+ messages / 2 participants
[nested] [flat]

* Problem With A Rule
@ 2002-04-11 11:09  cnliou@eurosport.com
  0 siblings, 1 reply; 2+ messages in thread

From: cnliou@eurosport.com @ 2002-04-11 11:09 UTC (permalink / raw)
  To: pgsql-sql

Hi!

When the following rule is created:

CREATE RULE rule1 AS ON UPDATE TO table1
DO UPDATE table2 SET column7=130 WHERE
column10=NEW.column10 
AND column1=(SELECT column1 FROM table3 
  WHERE column10=NEW.column10 AND column4='N'
 AND column5=NEW.column1)
AND column6='2'
AND column8=OLD.column7 AND column9=OLD.column2;

then postgresql seems to be confused by the following
SQL such that psql keeps waiting for postgresql's
result:
update table1 set column6=130 where column2=1;

I have to ctrl-c psql to wake up psql.

However, the following rule works without problem:

CREATE RULE rule1 AS ON UPDATE TO table1
DO UPDATE table2 SET column7=130 WHERE
column10=NEW.column10 
AND column1='OneConstant' AND column6='2'
AND column8=OLD.column7 AND column9=OLD.column2;

The following SQL also works fine:

update table2 set column7=130 where column10='1' 
and column1=(SELECT column1 FROM table3 WHERE
column10='1' AND column4='N'
  AND column5='ID1') and column6='2' and column8='r'
and column9=1;

Does rule has problem with subselect or the above
problematic rule has bug?

Regards,

cn

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com








^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Problem With A Rule
@ 2002-04-11 14:52  Tom Lane <tgl@sss.pgh.pa.us>
  parent: cnliou@eurosport.com
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2002-04-11 14:52 UTC (permalink / raw)
  To: cnliou@eurosport.com; +Cc: pgsql-sql

<cnliou@eurosport.com> writes:
> When the following rule is created:
> ...
> then postgresql seems to be confused by the following
> SQL such that psql keeps waiting for postgresql's
> result:

Could we see a *complete* example?  It's no fun trying to
reverse-engineer your table declarations from just the rule;
let alone any related rules that might be involved, or the
data in the table if the behavior happens to be data-dependent.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-04-11 14:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-04-11 11:09 Problem With A Rule cnliou@eurosport.com
2002-04-11 14:52 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox