blob: 2bb4318f7c76e7dfd6bd49c941fa4639f22a4bcc (
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
|
.pgaw:Help.f.t insert end "Functions" {title} "
The Functions tab is used to inspect the user defined functions in the\
database, to define new functions and to alter the existing ones.
Press the \"New\" button to define a new function. You should enter the\
function name, the function parameters (if any) separated by comma. \
If function returns a value, you should specify the " {} \
"PostgreSQL data type" {link data_types} " that function will return.
You must also specify the language that will be used to parse the defined\
function. You could specify SQL, plpgsql, pgtcl or C. Then you should enter the\
function body. Press \"Save\" button in order to save it
" {} "Example:" {italic} "
We have a table called \"products\" that is indexed on \"id\" (int4) field and\
contains the float8 field \"price\". We will define a new function \"get_product_price\"\
that will return the product price for a given id.
You should enter " {} "get_product_price" {code} " as the function name, " {} \
"int4" {code} " in parameters entry, " {} "float8" {code} " for returns, " {} \
"SQL" {code} " for the language. Then go to the function body definition and type:" {} "
SELECT price FROM products where id = \$1" {code} "
To delete a function, select it from the list box and use the menu command\
Object/Delete.
For more information see SQL commands " {} "CREATE FUNCTION" {link create_function} " and " {} \
"DROP FUNCTION" {link drop_function}
|