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

Rule system

From: Gena Gurchonok <gena(at)rt(dot)mipt(dot)ru>
To: bugs(at)postgreSQL(dot)org
Subject: Rule system
Date: 2000-06-30 13:28:37
Message-ID: 4728.000630@rt.mipt.ru (view raw or flat)
Thread:
Lists: pgsql-bugs
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               :Gena Gurchonok
Your email address      :gena(at)rt(dot)mipt(dot)ru


System Configuration
---------------------
  Architecture (example: Intel Pentium)         :Intel Celeroom

  Operating System (example: Linux 2.0.26 ELF)  : Linux 2.2.16 ELF

  PostgreSQL version (example: PostgreSQL-6.5.1):   PostgreSQL-7.0.2

  Compiler used (example:  gcc 2.8.0)           : gss 2.91.66


Please enter a FULL description of your problem:
------------------------------------------------
I've noticed interesting feature in PSQL 7.0.2
when executing insertion rules PSQL does not substitute new.* with
real values - it calculates these fields only as needed



Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

1 I create SEQUENCE ss
2 I create table tt with field (a int4 default NEXTVAL(ss) )
3 I create table t2 with field (i int4)
4 I
    create rule r as on insert to tt do insert into t2(i) values(new.a);

RESULT

For each insertion into tt sequence ss increases by 2. Tables tt and
t2 have DIFFERENT values after insert (for example tt have 2 and t2
have 1)



in rule system when rule executes it uses "non calculated information"
so we have NEXTVAL(ss) called twice:
 first time for rule command
 second time for insert command


If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Is it a bug or a feature?


Thanks for support.

Gena



pgsql-bugs by date

Next:From: Reinhard MaxDate: 2000-07-03 13:52:40
Subject: Patch for Linux-IA64
Previous:From: Matías GiovanniniDate: 2000-06-29 23:06:40
Subject: \d* won't work in 7.0.2?

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