alloc error on multiple action-queries within a rule - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject alloc error on multiple action-queries within a rule
Date
Msg-id 200108041154.f74BsN640349@hub.org
Whole thread Raw
Responses Re: alloc error on multiple action-queries within a rule  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
clemens oertel (oertel@uni-tuebingen.de) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
alloc error on multiple action-queries within a rule

Long Description
when executing the rule 'tax_genuses_del' (see sample code) postgresql reports 'ERROR:  Memory exhausted in
AllocSetAlloc(20)'.each of the the two action-queries runs perfectly by itself, as does the rule with only one of them.
neitheraction (update and insert) takes place. 

please do not hesitate to contact me if any further information is needed.

PostgreSQL Version: 7.1.2
PostgreSQL startup: /usr/local/bin/postmaster -D /home/pgsql -i (postgres)
OS: FreeBSD 4.2 release i386, AMD Duron, 256MB

Log-File:
TopMemoryContext: 40984 total in 5 blocks; 21896 free (29 chunks); 19088 used
TopTransactionContext: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used
DeferredTriggerXact: 8192 total in 1 blocks; 8104 free (0 chunks); 88 used
TransactionCommandContext: 266330112 total in 42 blocks; 544 free (1 chunks); 266329568 used
QueryContext: 57344 total in 3 blocks; 11768 free (0 chunks); 45576 used
DeferredTriggerSession: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used
CacheMemoryContext: 516096 total in 6 blocks; 122976 free (66 chunks); 393120 used
tax_genuses: 72704 total in 71 blocks; 1392 free (0 chunks); 71312 used
pg_rules: 5120 total in 5 blocks; 120 free (0 chunks); 5000 used
pg_user: 5120 total in 5 blocks; 912 free (0 chunks); 4208 used
PortalMemory: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used
MdSmgr: 8192 total in 1 blocks; 6120 free (0 chunks); 2072 used
DynaHash: 57344 total in 3 blocks; 30688 free (5 chunks); 26656 used
ErrorContext: 8192 total in 1 blocks; 8176 free (0 chunks); 16 used
ERROR:  Memory exhausted in AllocSetAlloc(20)


Sample Code
CREATE TABLE _tax_genuses (
  ins_on            TIMESTAMP,
  ins_by            VARCHAR(8),
  upd_on            TIMESTAMP,
  upd_by            VARCHAR(8),
  upd_count         INT2,
  deleted             BOOL,

  id                SERIAL,
  tfamily           INT4              NOT NULL,
  name              TEXT            NOT NULL,
  author            TEXT,

  CONSTRAINT tgenus_id PRIMARY KEY (id),
);

CREATE TABLE hist_tax_genuses AS SELECT * FROM _tax_genuses;

CREATE VIEW tax_genuses AS
  SELECT g.ins_on, g.ins_by, g.upd_on, g.upd_by, g.upd_count, g.id, g.tfamily, g.name, g.author
    FROM _tax_genuses g
      JOIN _tax_families f ON g.tfamily=f.id AND f.deleted=false
      JOIN _tax_orders o ON f.torder=o.id AND o.deleted=false
      JOIN _tax_classes c ON o.tclass=c.id AND c.deleted=false
      JOIN _tax_realms r ON c.trealm=r.id AND r.deleted=false
    WHERE g.deleted=false;

CREATE RULE tax_genuses_del AS
  ON DELETE TO tax_genuses DO INSTEAD
   (UPDATE _tax_genuses
      SET upd_on=now(), upd_by=current_user, upd_count=OLD.upd_count + 1, deleted=true
      WHERE id=OLD.id;
    INSERT INTO hist_tax_genuses SELECT * FROM _tax_genuses WHERE id=OLD.id);

INSERT INTO tax_genuses VALUES (NULL, NULL, NULL, NULL, NULL, NULL, 1, 'Ustlago', 'Oertel');
INSERT INTO tax_genuses VALUES (NULL, NULL, NULL, NULL, NULL, NULL, 1, 'Farysia', 'Oertel');
INSERT INTO tax_genuses VALUES (NULL, NULL, NULL, NULL, NULL, NULL, 1, 'Websdanea', 'Oertel');
INSERT INTO tax_genuses VALUES (NULL, NULL, NULL, NULL, NULL, NULL, 1, 'Cintractia', 'Oertel');

DELETE FROM tax_aliases WHERE id=4;

-- BOOM

No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Are temp table really invisible for existing table
Next
From: rychu@sky.pl
Date:
Subject: Odpowied¼ automatyczna