From: thomas.alton@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #14153: Unrecognized node type error when upsert is present in recursive CTE
Date: Sat, 21 May 2016 23:28:02 +0000
Message-ID: <20160521232802.22598.13537@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 14153
Logged by: Thomas Alton
Email address: thomas.alton@gmail.com
PostgreSQL version: 9.5.3
Operating system: Ubuntu 14.04.4 LTS
Description:
Simple repro steps that results in an "ERROR: unrecognized node type:
920"
CREATE TABLE foobar (
id TEXT PRIMARY KEY
);
WITH RECURSIVE upserted AS (
INSERT INTO foobar (id) VALUES ('a')
ON CONFLICT (id) DO NOTHING
RETURNING id
)
SELECT id from upserted;
In action:
postgres@postgres:/home/moatra$ psql
psql (9.5.3)
Type "help" for help.
postgres=# SELECT version();
version
-------------------------------------------------------------------------------------------------
PostgreSQL 9.5.3 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu
4.8.2-19ubuntu1) 4.8.2, 64-bit
(1 row)
postgres=# CREATE DATABASE example;
CREATE DATABASE
postgres=# \c example
You are now connected to database "example" as user "postgres".
example=# CREATE TABLE foobar (
example(# id TEXT PRIMARY KEY
example(# );
CREATE TABLE
example=#
example=# \set VERBOSITY verbose
example=#
example=# WITH RECURSIVE upserted AS (
example(# INSERT INTO foobar (id) VALUES ('a')
example(# ON CONFLICT (id) DO NOTHING
example(# RETURNING id
example(# )
example-# SELECT id FROM upserted;
ERROR: XX000: unrecognized node type: 920
LOCATION: raw_expression_tree_walker, nodeFuncs.c:3410
I expected the query run successfully and return one row with 'a'.
There doesn't even need to be a recursive query in the CTE, just the
RECURSIVE keyword. Removing the "ON CONFLICT ..." clause results in a
success.
example=# WITH RECURSIVE upserted AS (
example(# INSERT INTO foobar (id) VALUES ('a')
example(# RETURNING id
example(# )
example-# SELECT id FROM upserted;
id
----
a
(1 row)
Removing the "RECURSIVE" keyword and leaving the "ON CONFLICT ..." clause is
also successful.
example=# WITH upserted AS (
example(# INSERT INTO foobar (id) VALUES ('a'), ('b')
example(# ON CONFLICT (id) DO NOTHING
example(# RETURNING id
example(# )
example-# SELECT id FROM upserted;
id
----
b
(1 row)
The server was installed by adding the
http://apt.postgresql.org/pub/repos/apt/ repo and using apt for
installation. Originally I installed 9.5.2, but upgraded to 9.5.3 to
re-verify this bug on the latest release. Running uname -a gives:
moatra@postgres:~$ uname -a
Linux postgres 3.13.0-85-generic #129-Ubuntu SMP Thu Mar 17 20:50:15 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux
Please let me know if there's anything else I can do to be of assistance.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: thomas.alton@gmail.com
Subject: Re: BUG #14153: Unrecognized node type error when upsert is present in recursive CTE
In-Reply-To: <20160521232802.22598.13537@wrigleys.postgresql.org>
References: <20160521232802.22598.13537@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox