blob: 8694b8db6497315933bfe629bf9f95c9bd0dfd70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-- nspname.relname.attname%TYPE
DROP FUNCTION t();
CREATE OR REPLACE FUNCTION t() RETURNS TEXT AS '
DECLARE
col_name pg_catalog.pg_attribute.attname%TYPE;
BEGIN
col_name := ''uga'';
RETURN col_name;
END;
' LANGUAGE 'plpgsql';
SELECT t();
-- nspname.relname%ROWTYPE
DROP FUNCTION t();
CREATE OR REPLACE FUNCTION t() RETURNS pg_catalog.pg_attribute AS '
DECLARE
rec pg_catalog.pg_attribute%ROWTYPE;
BEGIN
SELECT INTO rec * FROM pg_catalog.pg_attribute WHERE attrelid = 1247 AND attname = ''typname'';
RETURN rec;
END;
' LANGUAGE 'plpgsql';
SELECT * FROM t();
-- nspname.relname.attname%TYPE
DROP FUNCTION t();
CREATE OR REPLACE FUNCTION t() RETURNS pg_catalog.pg_attribute.attname%TYPE AS '
DECLARE
rec pg_catalog.pg_attribute.attname%TYPE;
BEGIN
SELECT INTO rec pg_catalog.pg_attribute.attname FROM pg_catalog.pg_attribute WHERE attrelid = 1247 AND attname = ''typname'';
RETURN rec;
END;
' LANGUAGE 'plpgsql';
SELECT t();
-- nspname.relname%ROWTYPE
DROP FUNCTION t();
CREATE OR REPLACE FUNCTION t() RETURNS pg_catalog.pg_attribute AS '
DECLARE
rec pg_catalog.pg_attribute%ROWTYPE;
BEGIN
SELECT INTO rec * FROM pg_catalog.pg_attribute WHERE attrelid = 1247 AND attname = ''typname'';
RETURN rec;
END;
' LANGUAGE 'plpgsql';
SELECT * FROM t();
|