root/trunk/db-tests/plperl/0040-exceptions.sql

Revision 71, 0.6 kB (checked in by depesz, 4 years ago)

db-tests framework. Currently tests plperl if it works sanely

Line 
1 \set ECHO
2 \set QUIET 1
3
4 \pset format unaligned
5 \pset tuples_only true
6 \pset pager
7
8 \set ON_ERROR_ROLLBACK 1
9 \set ON_ERROR_STOP true
10 \set QUIET 1
11
12 SET client_encoding = utf8;
13
14 BEGIN;
15     SELECT plan(4);
16
17     SELECT lives_ok( 'CREATE LANGUAGE plperl', 'Language creation should work fine?!' );
18
19     SELECT lives_ok( E'CREATE function test1(INT4) RETURNS INT4 as $$ die "TEST\n" if $_[0] == 0; return 1; $$ language plperl');
20
21     SELECT lives_ok( 'SELECT test1(1)' );
22     SELECT throws_ok( 'SELECT test1(0)', 'XX000', 'error from Perl function "test1": TEST', 'Basic die() handling' );
23
24     SELECT * FROM finish();
25 ROLLBACK;
Note: See TracBrowser for help on using the browser.