pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14414: SPI_ERROR_CONNECT on stable plpgsql function used for domain check
2+ messages / 2 participants
[nested] [flat]

* BUG #14414: SPI_ERROR_CONNECT on stable plpgsql function used for domain check
@ 2016-11-06 01:09  marcos.castedo@anachronics.com
  0 siblings, 1 reply; 2+ messages in thread

From: marcos.castedo@anachronics.com @ 2016-11-06 01:09 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      14414
Logged by:          Marcos Castedo
Email address:      marcos.castedo@anachronics.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



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #14414: SPI_ERROR_CONNECT on stable plpgsql function used for domain check
@ 2016-11-06 17:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: marcos.castedo@anachronics.com
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2016-11-06 17:12 UTC (permalink / raw)
  To: marcos.castedo@anachronics.com; +Cc: pgsql-bugs

marcos.castedo@anachronics.com writes:
> 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.

Seems to be broken in 9.5 too :-(.  I pushed a fix, thanks for the report!

> --Only fails on stable function, immutable works fine

FWIW, both cases fail for me.  There may be some other effect in whatever
your original case was, but in this specific example an immutable function
fails too.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-11-06 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-11-06 01:09 BUG #14414: SPI_ERROR_CONNECT on stable plpgsql function used for domain check marcos.castedo@anachronics.com
2016-11-06 17:12 ` Tom Lane <tgl@sss.pgh.pa.us>

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