10
CREATE TYPE city_budget (
16
-- Test type-related default values (broken in releases before PG 7.2)
17
-- Make dummy I/O routines using the existing internal support for int4, text
18
CREATE FUNCTION int42_in(cstring)
21
LANGUAGE 'internal' WITH (isStrict);
22
NOTICE: type "int42" is not yet defined
23
DETAIL: Creating a shell type definition.
24
CREATE FUNCTION int42_out(int42)
27
LANGUAGE 'internal' WITH (isStrict);
28
NOTICE: argument type int42 is only a shell
29
CREATE FUNCTION text_w_default_in(cstring)
30
RETURNS text_w_default
32
LANGUAGE 'internal' WITH (isStrict);
33
NOTICE: type "text_w_default" is not yet defined
34
DETAIL: Creating a shell type definition.
35
CREATE FUNCTION text_w_default_out(text_w_default)
38
LANGUAGE 'internal' WITH (isStrict);
39
NOTICE: argument type text_w_default is only a shell
48
CREATE TYPE text_w_default (
49
internallength = variable,
50
input = text_w_default_in,
51
output = text_w_default_out,
55
CREATE TABLE default_test (f1 text_w_default, f2 int42);
56
INSERT INTO default_test DEFAULT VALUES;
57
SELECT * FROM default_test;
63
-- Test stand-alone composite type
64
CREATE TYPE default_test_row AS (f1 text_w_default, f2 int42);
65
CREATE FUNCTION get_default_test() RETURNS SETOF default_test_row AS '
66
SELECT * FROM default_test;
68
SELECT * FROM get_default_test();
75
COMMENT ON TYPE bad IS 'bad comment';
76
ERROR: type "bad" does not exist
77
COMMENT ON TYPE default_test_row IS 'good comment';
78
COMMENT ON TYPE default_test_row IS NULL;
79
DROP TYPE default_test_row CASCADE;
80
NOTICE: drop cascades to function get_default_test()
81
DROP TABLE default_test;