From: | Enrico Scholz <enrico(dot)scholz(at)cvg(dot)de> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Cc: | enrico(dot)scholz(at)cvg(dot)de |
Subject: | SERIAL's in INSERT rules |
Date: | 1999-09-06 12:17:40 |
Message-ID: | 199909061217.OAA04249@ensc-pc.cvg-i.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Enrico Scholz
Your email address : enrico(dot)scholz(at)informatik(dot)tu-chemnitz(dot)de
System Configuration
---------------------
Architecture (example: Intel Pentium) : i686
Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.12 ELF
PostgreSQL version (example: PostgreSQL-6.5.1): PostgreSQL-6.5.1
Compiler used (example: gcc 2.8.0) : egcs-2.91.66
Please enter a FULL description of your problem:
------------------------------------------------
The following statements
----------------------------------
create table foo ( id serial, data text );
create table foo1 ( id int );
create rule rule_ins as on insert to foo do insert into foo1 (id) values(NEW.id);
insert into foo(data) values('test');
select * from foo,foo1;
---------------------------------
are producing the unexpected result
id|data|id
--+----+--
2|test| 1
(both id's differ).
The thing I wanted to do is to insert an empty dataset into
foo1 for each new "id" in foo, so the result should be
"1|test|1".
I guess the default-value "nextval('foo_id_seq')" implicated
by the "serial" datatype will be used as a literal and not be
evaluated. So both NEW.id and the plain insert into foo will
call nextval(...).
Enrico
From | Date | Subject | |
---|---|---|---|
Next Message | Petter Reinholdtsen | 1999-09-06 21:49:49 | Re: [BUGS] temp tables failes in transaction mode |
Previous Message | Roland Roberts | 1999-09-06 02:45:25 | Re: [BUGS] pg_dumpall failed on dumpProcLangs() |