root/trunk/db-tests/plperl/0030-recordset.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(3);
16
17     SELECT lives_ok( 'CREATE LANGUAGE plperl', 'Language creation should work fine?!' );
18
19     CREATE type t1_srf as ( x TEXT, i INT4 );
20     SELECT lives_ok( E'CREATE function test1() RETURNS setof t1_srf as $$ return [ { "x" => "r1", "i" => 100 }, {"x" => "r2", "i" => 200} ]; $$ language plperl');
21
22     SELECT results_eq(
23         'SELECT * FROM test1()',
24         $$VALUES ( 'r1', 100 ), ('r2', 200)$$
25     );
26
27     SELECT * FROM finish();
28 ROLLBACK;
Note: See TracBrowser for help on using the browser.