BUG #3882: unexpected PARAM_SUBLINK ID

From: "Jan Mate" <mate(at)yeea(dot)eu>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3882: unexpected PARAM_SUBLINK ID
Date: 2008-01-17 15:44:32
Message-ID: 200801171544.m0HFiWvT067298@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3882
Logged by: Jan Mate
Email address: mate(at)yeea(dot)eu
PostgreSQL version: 8.2.6
Operating system: Linux and Mac OS X
Description: unexpected PARAM_SUBLINK ID
Details:

I am trying to create a row versioning table using view and rules.

The problem occur when I try to insert a new row to view using:

INSERT INTO "table" (number, level) VALUES(1, 1);

I get the following error:
ERROR: unexpected PARAM_SUBLINK ID: 3

BUT, the same INSERT RULE (see the dump below) works fine when I delete the
"limited" column from the table (and view) and modify the rules on the
view:

Dump of my DB is:

--
-- PostgreSQL database dump
--

SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

SET search_path = public, pg_catalog;

DROP RULE "_INSERT" ON public."table";
DROP INDEX public."r_table#_id#key";
ALTER TABLE ONLY public."r_table" DROP CONSTRAINT "r_table#pkey";
DROP SEQUENCE public."r_table#__id_entry#seq";
DROP VIEW public."table";
DROP TABLE public."r_table";
DROP SEQUENCE public."r_table#_id#seq";

--
-- Name: r_table#_id#seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE "r_table#_id#seq"
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1
CYCLE;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: r_table; Type: TABLE; Schema: public; Owner: -; Tablespace:
--

CREATE TABLE "r_table" (
_id bigint DEFAULT nextval('"r_table#_id#seq"'::regclass) NOT NULL,
__version bigint NOT NULL,
__latest boolean DEFAULT false NOT NULL,
__op_type text NOT NULL,
__timestamp timestamp without time zone NOT NULL,
__id_entry bigint NOT NULL,
number bigint NOT NULL,
limited timestamp without time zone,
"level" bigint DEFAULT 1 NOT NULL
);

--
-- Name: table; Type: VIEW; Schema: public; Owner: -
--
-- Select only the latest version of rows if they are not DELETED

CREATE VIEW "table" AS
SELECT "r_table"._id, "r_table".number, "r_table".limited,
"r_table"."level" FROM "r_table" WHERE (((("r_table".__id_entry,
"r_table".__version) IN (SELECT "r_table".__id_entry,
max("r_table".__version) AS __version FROM "r_table" GROUP BY
"r_table".__id_entry)) AND ("r_table".__op_type <> 'DELETE'::text)) AND
("r_table".__latest = true));

--
-- Name: r_table#__id_entry#seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE "r_table#__id_entry#seq"
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

--
-- Name: r_table#pkey; Type: CONSTRAINT; Schema: public; Owner: -;
Tablespace:
--

ALTER TABLE ONLY "r_table"
ADD CONSTRAINT "r_table#pkey" PRIMARY KEY (_id);

--
-- Name: r_table#_id#key; Type: INDEX; Schema: public; Owner: -; Tablespace:

--

CREATE UNIQUE INDEX "r_table#_id#key" ON "r_table" USING btree (_id);

--
-- Name: _INSERT; Type: RULE; Schema: public; Owner: -
--
-- Insert the new row only if there is not duplicate row in view

CREATE RULE "_INSERT" AS ON INSERT TO "table" DO INSTEAD INSERT INTO
"r_table" (__version, __latest, __op_type, __timestamp, __id_entry, number,
limited, "level") VALUES (0, true, 'INSERT'::text, now(),
nextval('"r_table#__id_entry#seq"'::regclass), (SELECT new.number WHERE (NOT
((new.number, new.limited, new."level") IN (SELECT "table".number,
"table".limited, "table"."level" FROM "table")))), new.limited,
new."level");

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Steven Flatt 2008-01-17 16:37:35 BUG #3883: Autovacuum deadlock with truncate?
Previous Message Stephen Frost 2008-01-17 14:37:29 Re: [ADMIN] postgresql in FreeBSD jails: proposal