Re: Sequence Incrementing by 2 insted of 1
От | Jasen Betts |
---|---|
Тема | Re: Sequence Incrementing by 2 insted of 1 |
Дата | |
Msg-id | gt6r0s$kao$1@reversiblemaps.ath.cx обсуждение исходный текст |
Ответ на | Sequence Incrementing by 2 insted of 1 (David <david@vanlaatum.id.au>) |
Список | pgsql-general |
On 2009-04-28, David <david@vanlaatum.id.au> wrote: > Ok got permission to send the code I think I have got all the relevent bits. > >CREATE TABLE currentcall ( > cadc_taskno integer DEFAULT nextval(('currentcall_cadc_taskno_seq'::text)::regclass) NOT NULL, > coversight character varying(4), ... >CREATE RULE currentcall_insert AS ON INSERT TO currentcall DO INSERT INTO > taskchangelog (tasknum, newstatus, newtech, status, newpriority, > newestcomplete, newclass, newnewtask) VALUES (new.cadc_taskno, ^^^^^^^^^^^^^^^ > new.cstatus, new.ctechalloc, new.ccustcomment, new.cfprior, > new.cestcomplete, new.cjobclass, (new.cnewtask = 'Y'::bpchar)); if you're inserting DEFAULT into the cadc_taskno column (or not explicitly setting that column) the re-writer will substitute nextval(('currentcall_cadc_taskno_seq'::text)::regclass) And that will be evaluated once for the insert and again for the rule. this is documented somewhere.... I think
В списке pgsql-general по дате отправления: