没有合适的资源?快使用搜索试试~ 我知道了~
首页PostgreSQL 9.0官方手册详解
PostgreSQL 9.0官方手册详解
需积分: 3 35 下载量 109 浏览量
更新于2024-07-31
收藏 7.12MB PDF 举报
"PostgreSQL-9.0官方手册是The PostgreSQL Global Development Group发布的一份详尽的文档,它详细介绍了PostgreSQL 9.0.1的核心特性和使用方法。这份英文版手册由该组织在1996年至2010年期间维护和更新,版权归属PostgreSQL Global Development Group。它遵循加州大学许可协议,允许用户在没有费用且无书面协议的情况下自由使用、复制、修改和分发软件及文档,但必须确保在所有副本中保留版权声明和相关条款。 手册的核心内容涵盖了PostgreSQL的基础架构、安装和配置、数据库管理、SQL语言操作、数据类型、索引与查询优化、事务处理、并发控制、存储过程、触发器、备份与恢复、以及安全性和性能调优等方面。此外,还包括了关于PostgreSQL 9.0的特性如窗口函数、扩展和插件的介绍,以及对错误处理和诊断工具的说明。 值得注意的是,尽管这是一个强大的开源数据库管理系统,但在使用过程中也存在一定的风险。手册明确指出,加州大学不对因使用此软件及其文档而产生的直接、间接、特殊或偶然损害(包括利润损失)承担责任,这表明用户在享受其便利的同时,也需自行承担一定的风险。 PostgreSQL-9.0官方手册是PostgreSQL 9.0版本的权威参考指南,对于开发人员、系统管理员和数据库工程师来说,无论是初次接触还是深入研究,都是不可或缺的学习资源。通过阅读和实践手册中的内容,用户可以全面了解和掌握PostgreSQL的核心功能和最佳实践,从而在实际项目中发挥其强大性能和灵活性。"
资源详情
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/2926738/bg10.jpg)
33.12. Preprocessor directives ....................................................................................... 671
33.12.1. Including files......................................................................................... 671
33.12.2. The #define and #undef directives ......................................................... 671
33.12.3. ifdef, ifndef, else, elif, and endif directives ...........................................672
33.13. Processing Embedded SQL Programs................................................................ 672
33.14. Library Functions ............................................................................................... 673
33.15. Internals .............................................................................................................. 674
34. The Information Schema................................................................................................... 677
34.1. The Schema .......................................................................................................... 677
34.2. Data Types ............................................................................................................ 677
34.3. information_schema_catalog_name ...........................................................677
34.4. administrable_role_authorizations.......................................................678
34.5. applicable_roles............................................................................................ 678
34.6. attributes......................................................................................................... 679
34.7. check_constraint_routine_usage ............................................................. 681
34.8. check_constraints ......................................................................................... 682
34.9. column_domain_usage ..................................................................................... 682
34.10. column_privileges ....................................................................................... 683
34.11. column_udt_usage.......................................................................................... 684
34.12. columns ............................................................................................................. 684
34.13. constraint_column_usage .......................................................................... 689
34.14. constraint_table_usage............................................................................. 689
34.15. data_type_privileges................................................................................. 690
34.16. domain_constraints ..................................................................................... 691
34.17. domain_udt_usage.......................................................................................... 691
34.18. domains ............................................................................................................. 692
34.19. element_types ................................................................................................ 694
34.20. enabled_roles ................................................................................................ 697
34.21. foreign_data_wrapper_options................................................................ 697
34.22. foreign_data_wrappers............................................................................... 698
34.23. foreign_server_options............................................................................. 698
34.24. foreign_servers............................................................................................ 699
34.25. key_column_usage.......................................................................................... 699
34.26. parameters....................................................................................................... 700
34.27. referential_constraints .......................................................................... 703
34.28. role_column_grants ..................................................................................... 704
34.29. role_routine_grants ................................................................................... 704
34.30. role_table_grants ....................................................................................... 705
34.31. role_usage_grants ....................................................................................... 706
34.32. routine_privileges ..................................................................................... 706
34.33. routines...........................................................................................................707
34.34. schemata...........................................................................................................713
34.35. sequences......................................................................................................... 713
34.36. sql_features .................................................................................................. 714
34.37. sql_implementation_info .......................................................................... 715
34.38. sql_languages ................................................................................................ 716
34.39. sql_packages .................................................................................................. 716
34.40. sql_parts......................................................................................................... 717
34.41. sql_sizing....................................................................................................... 717
34.42. sql_sizing_profiles ................................................................................... 718
34.43. table_constraints ....................................................................................... 718
34.44. table_privileges.......................................................................................... 719
xvi
![](https://csdnimg.cn/release/download_crawler_static/2926738/bg11.jpg)
34.45. tables ...............................................................................................................720
34.46. triggered_update_columns ........................................................................ 720
34.47. triggers...........................................................................................................721
34.48. usage_privileges.......................................................................................... 723
34.49. user_mapping_options................................................................................. 723
34.50. user_mappings ................................................................................................ 724
34.51. view_column_usage ....................................................................................... 724
34.52. view_routine_usage ..................................................................................... 725
34.53. view_table_usage.......................................................................................... 725
34.54. views ................................................................................................................. 726
V. Server Programming ................................................................................................................. 728
35. Extending SQL.................................................................................................................. 730
35.1. How Extensibility Works...................................................................................... 730
35.2. The PostgreSQL Type System.............................................................................. 730
35.2.1. Base Types ............................................................................................... 730
35.2.2. Composite Types...................................................................................... 730
35.2.3. Domains ................................................................................................... 731
35.2.4. Pseudo-Types ........................................................................................... 731
35.2.5. Polymorphic Types ..................................................................................731
35.3. User-Defined Functions........................................................................................ 732
35.4. Query Language (SQL) Functions ....................................................................... 732
35.4.1. SQL Functions on Base Types ................................................................. 733
35.4.2. SQL Functions on Composite Types .......................................................735
35.4.3. SQL Functions with Parameter Names.................................................... 738
35.4.4. SQL Functions with Output Parameters .................................................. 738
35.4.5. SQL Functions with Variable Numbers of Arguments ............................ 739
35.4.6. SQL Functions with Default Values for Arguments ................................ 740
35.4.7. SQL Functions as Table Sources .............................................................741
35.4.8. SQL Functions Returning Sets ................................................................ 741
35.4.9. SQL Functions Returning TABLE ............................................................ 743
35.4.10. Polymorphic SQL Functions ................................................................. 743
35.5. Function Overloading........................................................................................... 745
35.6. Function Volatility Categories.............................................................................. 746
35.7. Procedural Language Functions ........................................................................... 747
35.8. Internal Functions................................................................................................. 747
35.9. C-Language Functions.......................................................................................... 748
35.9.1. Dynamic Loading..................................................................................... 748
35.9.2. Base Types in C-Language Functions...................................................... 749
35.9.3. Version 0 Calling Conventions ................................................................752
35.9.4. Version 1 Calling Conventions ................................................................754
35.9.5. Writing Code............................................................................................ 757
35.9.6. Compiling and Linking Dynamically-Loaded Functions ........................ 757
35.9.7. Extension Building Infrastructure............................................................ 759
35.9.8. Composite-Type Arguments .................................................................... 761
35.9.9. Returning Rows (Composite Types) ........................................................ 763
35.9.10. Returning Sets........................................................................................765
35.9.11. Polymorphic Arguments and Return Types ........................................... 769
35.9.12. Shared Memory and LWLocks .............................................................. 771
35.10. User-Defined Aggregates ...................................................................................772
35.11. User-Defined Types ............................................................................................ 774
35.12. User-Defined Operators...................................................................................... 777
xvii
![](https://csdnimg.cn/release/download_crawler_static/2926738/bg12.jpg)
35.13. Operator Optimization Information.................................................................... 778
35.13.1. COMMUTATOR.......................................................................................... 778
35.13.2. NEGATOR ................................................................................................ 779
35.13.3. RESTRICT .............................................................................................. 779
35.13.4. JOIN.......................................................................................................780
35.13.5. HASHES................................................................................................... 781
35.13.6. MERGES................................................................................................... 782
35.14. Interfacing Extensions To Indexes...................................................................... 782
35.14.1. Index Methods and Operator Classes ....................................................782
35.14.2. Index Method Strategies ........................................................................ 783
35.14.3. Index Method Support Routines ............................................................ 784
35.14.4. An Example ........................................................................................... 786
35.14.5. Operator Classes and Operator Families................................................ 788
35.14.6. System Dependencies on Operator Classes ........................................... 791
35.14.7. Special Features of Operator Classes..................................................... 792
35.15. Using C++ for Extensibility ............................................................................... 792
36. Triggers ............................................................................................................................. 794
36.1. Overview of Trigger Behavior.............................................................................. 794
36.2. Visibility of Data Changes.................................................................................... 795
36.3. Writing Trigger Functions in C ............................................................................ 796
36.4. A Complete Trigger Example............................................................................... 798
37. The Rule System ............................................................................................................... 803
37.1. The Query Tree..................................................................................................... 803
37.2. Views and the Rule System .................................................................................. 805
37.2.1. How SELECT Rules Work ........................................................................ 805
37.2.2. View Rules in Non-SELECT Statements .................................................. 810
37.2.3. The Power of Views in PostgreSQL ........................................................ 811
37.2.4. Updating a View.......................................................................................811
37.3. Rules on INSERT, UPDATE, and DELETE ............................................................. 811
37.3.1. How Update Rules Work .........................................................................811
37.3.1.1. A First Rule Step by Step............................................................ 813
37.3.2. Cooperation with Views........................................................................... 816
37.4. Rules and Privileges ............................................................................................. 821
37.5. Rules and Command Status.................................................................................. 822
37.6. Rules versus Triggers ........................................................................................... 823
38. Procedural Languages ....................................................................................................... 826
38.1. Installing Procedural Languages .......................................................................... 826
39. PL/pgSQL - SQL Procedural Language ........................................................................... 829
39.1. Overview ..............................................................................................................829
39.1.1. Advantages of Using PL/pgSQL ............................................................. 829
39.1.2. Supported Argument and Result Data Types........................................... 829
39.2. Structure of PL/pgSQL......................................................................................... 830
39.3. Declarations.......................................................................................................... 831
39.3.1. Declaring Function Parameters................................................................ 832
39.3.2. ALIAS....................................................................................................... 834
39.3.3. Copying Types ......................................................................................... 835
39.3.4. Row Types................................................................................................ 835
39.3.5. Record Types ........................................................................................... 836
39.4. Expressions........................................................................................................... 836
39.5. Basic Statements................................................................................................... 837
39.5.1. Assignment .............................................................................................. 837
39.5.2. Executing a Command With No Result ................................................... 837
xviii
![](https://csdnimg.cn/release/download_crawler_static/2926738/bg13.jpg)
39.5.3. Executing a Query with a Single-Row Result ......................................... 838
39.5.4. Executing Dynamic Commands .............................................................. 839
39.5.5. Obtaining the Result Status...................................................................... 842
39.5.6. Doing Nothing At All .............................................................................. 843
39.6. Control Structures................................................................................................. 843
39.6.1. Returning From a Function......................................................................843
39.6.1.1. RETURN........................................................................................ 843
39.6.1.2. RETURN NEXT and RETURN QUERY ........................................... 844
39.6.2. Conditionals ............................................................................................. 845
39.6.2.1. IF-THEN...................................................................................... 845
39.6.2.2. IF-THEN-ELSE ........................................................................... 846
39.6.2.3. IF-THEN-ELSIF.........................................................................846
39.6.2.4. Simple CASE................................................................................ 847
39.6.2.5. Searched CASE............................................................................. 848
39.6.3. Simple Loops ........................................................................................... 848
39.6.3.1. LOOP ............................................................................................ 848
39.6.3.2. EXIT ............................................................................................ 849
39.6.3.3. CONTINUE.................................................................................... 849
39.6.3.4. WHILE .......................................................................................... 850
39.6.3.5. FOR (integer variant).................................................................... 850
39.6.4. Looping Through Query Results ............................................................. 851
39.6.5. Trapping Errors........................................................................................ 852
39.7. Cursors.................................................................................................................. 854
39.7.1. Declaring Cursor Variables ...................................................................... 854
39.7.2. Opening Cursors ...................................................................................... 855
39.7.2.1. OPEN FOR query........................................................................ 855
39.7.2.2. OPEN FOR EXECUTE .................................................................. 855
39.7.2.3. Opening a Bound Cursor............................................................. 856
39.7.3. Using Cursors........................................................................................... 856
39.7.3.1. FETCH .......................................................................................... 856
39.7.3.2. MOVE ............................................................................................ 857
39.7.3.3. UPDATE/DELETE WHERE CURRENT OF .................................... 857
39.7.3.4. CLOSE .......................................................................................... 858
39.7.3.5. Returning Cursors .......................................................................858
39.7.4. Looping Through a Cursor’s Result......................................................... 859
39.8. Errors and Messages............................................................................................. 860
39.9. Trigger Procedures ...............................................................................................861
39.10. PL/pgSQL Under the Hood ................................................................................ 866
39.10.1. Variable Substitution.............................................................................. 867
39.10.2. Plan Caching .......................................................................................... 869
39.11. Tips for Developing in PL/pgSQL......................................................................870
39.11.1. Handling of Quotation Marks ................................................................ 871
39.12. Porting from Oracle PL/SQL.............................................................................. 872
39.12.1. Porting Examples................................................................................... 873
39.12.2. Other Things to Watch For..................................................................... 878
39.12.2.1. Implicit Rollback after Exceptions............................................ 878
39.12.2.2. EXECUTE.................................................................................... 879
39.12.2.3. Optimizing PL/pgSQL Functions.............................................. 879
39.12.3. Appendix................................................................................................ 879
40. PL/Tcl - Tcl Procedural Language....................................................................................882
40.1. Overview ..............................................................................................................882
40.2. PL/Tcl Functions and Arguments......................................................................... 882
xix
![](https://csdnimg.cn/release/download_crawler_static/2926738/bg14.jpg)
40.3. Data Values in PL/Tcl........................................................................................... 883
40.4. Global Data in PL/Tcl ..........................................................................................884
40.5. Database Access from PL/Tcl .............................................................................. 884
40.6. Trigger Procedures in PL/Tcl ............................................................................... 886
40.7. Modules and the unknown command................................................................... 888
40.8. Tcl Procedure Names ...........................................................................................888
41. PL/Perl - Perl Procedural Language.................................................................................. 890
41.1. PL/Perl Functions and Arguments........................................................................ 890
41.2. Data Values in PL/Perl.......................................................................................... 893
41.3. Built-in Functions................................................................................................. 893
41.3.1. Database Access from PL/Perl................................................................. 893
41.3.2. Utility functions in PL/Perl......................................................................896
41.4. Global Values in PL/Perl ...................................................................................... 897
41.5. Trusted and Untrusted PL/Perl ............................................................................. 898
41.6. PL/Perl Triggers ...................................................................................................899
41.7. PL/Perl Under the Hood ....................................................................................... 901
41.7.1. Configuration ........................................................................................... 901
41.7.2. Limitations and Missing Features............................................................902
42. PL/Python - Python Procedural Language........................................................................903
42.1. Python 2 vs. Python 3........................................................................................... 903
42.2. PL/Python Functions ............................................................................................ 904
42.3. Data Values........................................................................................................... 905
42.3.1. Data Type Mapping.................................................................................. 905
42.3.2. Null, None................................................................................................ 906
42.3.3. Arrays, Lists.............................................................................................907
42.3.4. Composite Types...................................................................................... 907
42.3.5. Set-Returning Functions .......................................................................... 909
42.4. Sharing Data ......................................................................................................... 910
42.5. Anonymous Code Blocks ..................................................................................... 910
42.6. Trigger Functions .................................................................................................911
42.7. Database Access ................................................................................................... 911
42.8. Utility Functions................................................................................................... 912
42.9. Environment Variables ......................................................................................... 913
43. Server Programming Interface .......................................................................................... 914
43.1. Interface Functions ............................................................................................... 914
SPI_connect ......................................................................................................... 914
SPI_finish.............................................................................................................916
SPI_push .............................................................................................................. 917
SPI_pop................................................................................................................ 918
SPI_execute.......................................................................................................... 919
SPI_exec............................................................................................................... 922
SPI_execute_with_args........................................................................................923
SPI_prepare.......................................................................................................... 925
SPI_prepare_cursor.............................................................................................. 927
SPI_prepare_params ............................................................................................ 928
SPI_getargcount...................................................................................................929
SPI_getargtypeid.................................................................................................. 930
SPI_is_cursor_plan .............................................................................................. 931
SPI_execute_plan................................................................................................. 932
SPI_execute_plan_with_paramlist....................................................................... 934
SPI_execp............................................................................................................. 935
SPI_cursor_open.................................................................................................. 936
xx
剩余2281页未读,继续阅读
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://profile-avatar.csdnimg.cn/176ed2f5f89e49d2b89943772742150b_armstrong311.jpg!1)
![](https://csdnimg.cn/release/wenkucmsfe/public/img/user-vip.1c89f3c5.png)
Armstrong311
- 粉丝: 2
- 资源: 20
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![](https://csdnimg.cn/release/wenkucmsfe/public/img/voice.245cc511.png)
最新资源
- 构建Cadence PSpice仿真模型库教程
- VMware 10.0安装指南:步骤详解与网络、文件共享解决方案
- 中国互联网20周年必读:影响行业的100本经典书籍
- SQL Server 2000 Analysis Services的经典MDX查询示例
- VC6.0 MFC操作Excel教程:亲测Win7下的应用与保存技巧
- 使用Python NetworkX处理网络图
- 科技驱动:计算机控制技术的革新与应用
- MF-1型机器人硬件与robobasic编程详解
- ADC性能指标解析:超越位数、SNR和谐波
- 通用示波器改造为逻辑分析仪:0-1字符显示与电路设计
- C++实现TCP控制台客户端
- SOA架构下ESB在卷烟厂的信息整合与决策支持
- 三维人脸识别:技术进展与应用解析
- 单张人脸图像的眼镜边框自动去除方法
- C语言绘制图形:余弦曲线与正弦函数示例
- Matlab 文件操作入门:fopen、fclose、fprintf、fscanf 等函数使用详解
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035711.png)
![](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![](https://csdnimg.cn/release/wenkucmsfe/public/img/green-success.6a4acb44.png)