Question about "Unrecognized SPI code" ...

From: Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>
To: pgsql-hackers(at)postgresql(dot)org, eg(at)cybertec(dot)at
Subject: Question about "Unrecognized SPI code" ...
Date: 2005-02-22 13:31:39
Message-ID: 421B343B.9050606@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just found an interesting issue in recent PostgreSQL releases:

CREATE VIEW view_nonsense AS SELECT 1 AS a, 2 AS b;

CREATE RULE myrule AS ON INSERT TO view_nonsense
DO INSTEAD NOTHING;

CREATE OR REPLACE FUNCTION debug() RETURNS boolean AS '
DECLARE

BEGIN
INSERT INTO view_nonsense VALUES (10, 20);
RETURN true;
END;
' LANGUAGE 'plpgsql';

SELECT debug();

The INSERT statement is not doing something useful here

[hs(at)athlon tmp]$ psql test < view.sql
CREATE VIEW
CREATE RULE
CREATE FUNCTION
ERROR: SPI_execute_plan failed executing query "INSERT INTO
view_nonsense VALUES (10, 20)": Unrecognized SPI code 0
CONTEXT: PL/pgSQL function "debug" line 4 at SQL statement

SPI_result_code_string(int code) and PL/pgSQL don't seem to be aware of
DO NOTHING rules.
Is it desired behaviour?

Best regards,

Hans

--
Cybertec Geschwinde u Schoenig
Schoengrabern 134, A-2020 Hollabrunn, Austria
Tel: +43/660/816 40 77
www.cybertec.at, www.postgresql.at

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2005-02-22 13:36:05 Re: Get rid of system attributes in pg_attribute?
Previous Message Robert Treat 2005-02-22 13:29:47 Re: Get rid of system attributes in pg_attribute?