文件名称:存储过程-Greenplum 数据库基础培训V1.2
文件大小:7.92MB
文件格式:PPT
更新时间:2024-05-15 15:14:50
Greenplum 中文
存储过程 Greenplum支持SQL/PYTHON/PERL/C语言构建函数,以下着重介绍SQL 存储过程。 一个存储过程就是一个事务,包括对子过程的调用都在一个事务内 存储过程结构: CREATE FUNCTION somefunc() RETURNS integer AS $$ DECLARE quantity integer := 30; BEGIN RETURN ....; END; $$ LANGUAGE plpgsql; 赋值 给一个变量或行/记录赋值用下面方法:identifier := expression 例子:user_id := 20; 执行一个没有结果的查询: PERFORM query; 一个例子: PERFORM create_mv('cs_session_page_requests_mv', my_query); 存储过程请参考: * Instructor Notes By default, the master host is configured to allow remote client connections from the default superuser account only. This is the user who initialized the Greenplum array. In this case, the OS user name and the Greenplum database user name are the same, but this may not always be the case for other users. Let’s go over each line of the pg_hba.conf file for the master host and explain what is happening: Lines 1 and 2 are saying that for local UNIX domain socket connections allow the gpadmin user (the superuser who bootstrapped the array, lab# in our training environment) and all users to connect to all databases. The ident authentication method works by obtaining the client's OS user name, then determining the allowed database user names using a map file. There is a predefined ident map named sameuser, which allows any operating system user to connect as the database user of the same name. Any other maps must be created manually using the pg_ident.conf file. Line 3 is saying that for TCP/IP connections allow only the gpadmin superuser to connect to all databases when the connection comes from the local host. Note that the CIDR address is in IPv4 format. trust means no authentication is performed. Line 4 is saying that for any remote host TCP/IP connections allow only the gpadmin superuser to connect to all databases. Note that the CIDR address is in IPv4 format. md5 means password authentication is performed. If no password is provided at initialization time, the default password is mpparray.