~ubuntu-branches/ubuntu/natty/postgresql-8.4/natty-security

« back to all changes in this revision

Viewing changes to src/test/regress/sql/rangefuncs.sql

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
351
351
select t.a, t, t.a from foo1(10000) t limit 1;
352
352
 
353
353
drop function foo1(n integer);
 
354
 
 
355
-- test use of SQL functions returning record
 
356
-- this is supported in some cases where the query doesn't specify
 
357
-- the actual record type ...
 
358
 
 
359
create function array_to_set(anyarray) returns setof record as $$
 
360
  select i AS "index", $1[i] AS "value" from generate_subscripts($1, 1) i
 
361
$$ language sql strict immutable;
 
362
 
 
363
select array_to_set(array['one', 'two']);
 
364
select * from array_to_set(array['one', 'two']) as t(f1 int,f2 text);
 
365
select * from array_to_set(array['one', 'two']); -- fail
 
366
 
 
367
create temp table foo(f1 int8, f2 int8);
 
368
 
 
369
create function testfoo() returns record as $$
 
370
  insert into foo values (1,2) returning *;
 
371
$$ language sql;
 
372
 
 
373
select testfoo();
 
374
select * from testfoo() as t(f1 int8,f2 int8);
 
375
select * from testfoo(); -- fail
 
376
 
 
377
drop function testfoo();
 
378
 
 
379
create function testfoo() returns setof record as $$
 
380
  insert into foo values (1,2), (3,4) returning *;
 
381
$$ language sql;
 
382
 
 
383
select testfoo();
 
384
select * from testfoo() as t(f1 int8,f2 int8);
 
385
select * from testfoo(); -- fail
 
386
 
 
387
drop function testfoo();