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

Re: BUG #4434: Error inserting into view - unrecognized node type: 313

From: "Alex Hunsaker" <badalex(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Dean Rasheed" <dean_rasheed(at)hotmail(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4434: Error inserting into view - unrecognized node type: 313
Date: 2008-09-24 07:38:01
Message-ID: 34d269d40809240038n1bb36a00w5c3ad6a0b6cb9c15@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Tue, Sep 23, 2008 at 10:38 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Dean Rasheed" <dean_rasheed(at)hotmail(dot)com> writes:
>> CREATE TABLE foo(a int, b int);
>> CREATE VIEW foo_v AS SELECT * FROM foo;
>> CREATE RULE foo_r AS ON INSERT TO foo_v DO INSTEAD INSERT INTO foo
>> VALUES(NEW.a, NEW.b);
>> INSERT INTO foo_v VALUES ((SELECT 1), (SELECT 2)), ((SELECT 3), (SELECT 4));
>
>> ERROR:  unrecognized node type: 313
>
> It looks like the parser's code path for multi-row VALUES is neglecting
> to detect sublinks and set pstate->p_hasSubLinks.  I'm too tired to look
> closer tonight; anyone want to poke into it?
>
>                        regards, tom lane

The below fixes it for me...  Its probably in the wrong place,  and
does not even try to do any detection... but here it is anyway

*** a/src/backend/parser/analyze.c
--- b/src/backend/parser/analyze.c
***************
*** 538,543 **** transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
--- 538,545 ----
  		 */
  		List	   *valuesLists = selectStmt->valuesLists;

+ 		pstate->p_hasSubLinks = true;
+
  		Assert(list_length(valuesLists) == 1);

  		/* Do basic expression transformation (same as a ROW() expr) */

In response to

pgsql-bugs by date

Next:From: Magnus HaganderDate: 2008-09-24 09:02:55
Subject: Re: [HACKERS] 0x1A in control file on Windows
Previous:From: Heikki LinnakangasDate: 2008-09-24 07:37:53
Subject: Re: BUG #4434: Error inserting into view - unrecognized node type: 313

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