BUG #14414: SPI_ERROR_CONNECT on stable plpgsql function used for domain check

From: marcos(dot)castedo(at)anachronics(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14414: SPI_ERROR_CONNECT on stable plpgsql function used for domain check
Date: 2016-11-06 01:09:47
Message-ID: 20161106010947.1387.66380@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14414
Logged by: Marcos Castedo
Email address: marcos(dot)castedo(at)anachronics(dot)com
PostgreSQL version: 9.6.1
Operating system: Debian stretch
Description:

I'm trying to do a domain using stable plpgsql function for value check.
This isn't working on 9.6.x on plpgsql using assignment from base data type,
but it works fine on 9.2.x.

Test case:

BEGIN;

--Only fails on stable function, immutable works fine
CREATE OR REPLACE FUNCTION x_domain_test_check()
RETURNS boolean AS $$
BEGIN
RETURN true;
END;
$$ LANGUAGE plpgsql STABLE;

CREATE DOMAIN x_domain_test AS integer CHECK(x_domain_test_check());

DO $$
DECLARE
v_test x_domain_test;
BEGIN
v_test := 1;
END;
$$;

ROLLBACK;

Output on PostgreSQL 9.2.17 (expected)
DO
ROLLBACK

Output on PostgreSQL 9.6.1 (error)

ERROR: SPI_connect failed: SPI_ERROR_CONNECT
CONTEXT: PL/pgSQL function inline_code_block line 5 at assignment
ROLLBACK

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message MauMau 2016-11-06 09:11:04 Re: BUG #13755: pgwin32_is_service not checking if SECURITY_SERVICE_SID is disabled
Previous Message John R Pierce 2016-11-05 05:33:17 Re: BUG #14413: pgadmin3 crashes on start