没有合适的资源?快使用搜索试试~ 我知道了~
首页PostgreSQL 9.0.4 官方文档
PostgreSQL 9.0.4 官方文档
4星 · 超过85%的资源 需积分: 10 3 下载量 24 浏览量
更新于2024-07-28
收藏 7.19MB PDF 举报
"这是一份PostgreSQL 9.0.4的官方文档,由PostgreSQL全球开发团队编撰,版权自1996年至2010年属于PostgreSQL全球开发团队。文档遵循加州大学的许可协议条款。"
在PostgreSQL 9.0.4的文档中,用户可以了解到这个版本的数据库系统的详细信息。PostgreSQL是一款开源的对象关系型数据库管理系统(ORDBMS),它拥有强大的功能、高度的稳定性和良好的社区支持。9.0.4版本作为该系列的一个重要里程碑,可能包含了一些关键的改进和修复。
文档会涵盖多个主题,包括但不限于:
1. **安装与配置**:指导用户如何在不同的操作系统上安装PostgreSQL 9.0.4,以及如何配置数据库服务器的参数以满足特定需求。
2. **SQL语言**:详述了PostgreSQL对SQL标准的支持,包括数据定义(DDL)、数据操作(DML)、查询(SELECT)、事务处理和并发控制等。
3. **类型与函数**:介绍PostgreSQL丰富的内建数据类型,如数值类型、字符串类型、日期时间类型,以及各种内置函数和运算符。
4. **索引与查询优化**:阐述如何创建和管理索引以提升查询性能,并讨论查询规划器的工作原理和优化策略。
5. **安全性与权限**:讲解用户管理、角色、权限系统和访问控制,确保数据的安全性。
6. **复制与高可用**:介绍复制技术,如流式复制和并行复制,用于实现故障转移和负载均衡。
7. **并行执行**:可能包括9.0.4版本中引入的并行查询功能,以提高大数据量处理的效率。
8. **存储过程与触发器**:说明如何编写和使用存储过程、触发器来扩展数据库功能。
9. **性能监控与调优**:提供工具和方法来分析和优化数据库性能。
10. **备份与恢复**:指导用户进行数据库的备份和恢复操作,确保数据安全。
11. **扩展性**:可能包含关于创建和使用自定义模块,如UDFs(用户定义函数)和类型的信息。
此外,文档还会详细解释错误处理、日志记录、系统视图、并发问题和死锁处理等重要概念。值得注意的是,PostgreSQL的许可条款规定,软件及其文档可以自由使用、复制和修改,但必须保留原有的版权信息,且不提供任何形式的保修,对于因使用软件导致的任何损失,加州大学不承担责任。
对于开发者、DBA或需要深入了解PostgreSQL 9.0.4的人来说,这份文档是必不可少的参考资料,它将帮助用户全面掌握数据库的使用、管理和维护。
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
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
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.................................................................................. 823
37.6. Rules versus Triggers ........................................................................................... 823
38. Procedural Languages ....................................................................................................... 827
38.1. Installing Procedural Languages .......................................................................... 827
39. PL/pgSQL - SQL Procedural Language ........................................................................... 830
39.1. Overview ..............................................................................................................830
39.1.1. Advantages of Using PL/pgSQL ............................................................. 830
39.1.2. Supported Argument and Result Data Types........................................... 830
39.2. Structure of PL/pgSQL......................................................................................... 831
39.3. Declarations.......................................................................................................... 832
39.3.1. Declaring Function Parameters................................................................ 833
39.3.2. ALIAS....................................................................................................... 835
39.3.3. Copying Types ......................................................................................... 836
39.3.4. Row Types................................................................................................ 836
39.3.5. Record Types ........................................................................................... 837
39.4. Expressions........................................................................................................... 837
39.5. Basic Statements................................................................................................... 838
39.5.1. Assignment .............................................................................................. 838
39.5.2. Executing a Command With No Result ................................................... 838
xviii
39.5.3. Executing a Query with a Single-Row Result ......................................... 839
39.5.4. Executing Dynamic Commands .............................................................. 840
39.5.5. Obtaining the Result Status...................................................................... 843
39.5.6. Doing Nothing At All .............................................................................. 844
39.6. Control Structures................................................................................................. 844
39.6.1. Returning From a Function...................................................................... 844
39.6.1.1. RETURN........................................................................................ 844
39.6.1.2. RETURN NEXT and RETURN QUERY ........................................... 845
39.6.2. Conditionals ............................................................................................. 846
39.6.2.1. IF-THEN...................................................................................... 846
39.6.2.2. IF-THEN-ELSE ........................................................................... 847
39.6.2.3. IF-THEN-ELSIF......................................................................... 847
39.6.2.4. Simple CASE................................................................................ 848
39.6.2.5. Searched CASE............................................................................. 849
39.6.3. Simple Loops ........................................................................................... 849
39.6.3.1. LOOP ............................................................................................ 849
39.6.3.2. EXIT ............................................................................................ 850
39.6.3.3. CONTINUE.................................................................................... 850
39.6.3.4. WHILE .......................................................................................... 851
39.6.3.5. FOR (integer variant).................................................................... 851
39.6.4. Looping Through Query Results ............................................................. 852
39.6.5. Trapping Errors........................................................................................ 853
39.7. Cursors.................................................................................................................. 855
39.7.1. Declaring Cursor Variables ...................................................................... 855
39.7.2. Opening Cursors ...................................................................................... 856
39.7.2.1. OPEN FOR query........................................................................ 856
39.7.2.2. OPEN FOR EXECUTE .................................................................. 856
39.7.2.3. Opening a Bound Cursor............................................................. 857
39.7.3. Using Cursors........................................................................................... 857
39.7.3.1. FETCH .......................................................................................... 857
39.7.3.2. MOVE ............................................................................................ 858
39.7.3.3. UPDATE/DELETE WHERE CURRENT OF .................................... 858
39.7.3.4. CLOSE .......................................................................................... 859
39.7.3.5. Returning Cursors .......................................................................859
39.7.4. Looping Through a Cursor’s Result......................................................... 860
39.8. Errors and Messages............................................................................................. 861
39.9. Trigger Procedures ...............................................................................................862
39.10. PL/pgSQL Under the Hood ................................................................................ 867
39.10.1. Variable Substitution.............................................................................. 868
39.10.2. Plan Caching .......................................................................................... 870
39.11. Tips for Developing in PL/pgSQL......................................................................871
39.11.1. Handling of Quotation Marks ................................................................ 872
39.12. Porting from Oracle PL/SQL.............................................................................. 873
39.12.1. Porting Examples................................................................................... 874
39.12.2. Other Things to Watch For..................................................................... 879
39.12.2.1. Implicit Rollback after Exceptions............................................ 879
39.12.2.2. EXECUTE.................................................................................... 880
39.12.2.3. Optimizing PL/pgSQL Functions.............................................. 880
39.12.3. Appendix................................................................................................ 880
40. PL/Tcl - Tcl Procedural Language.................................................................................... 883
40.1. Overview ..............................................................................................................883
40.2. PL/Tcl Functions and Arguments......................................................................... 883
xix
40.3. Data Values in PL/Tcl........................................................................................... 884
40.4. Global Data in PL/Tcl ..........................................................................................885
40.5. Database Access from PL/Tcl .............................................................................. 885
40.6. Trigger Procedures in PL/Tcl ............................................................................... 887
40.7. Modules and the unknown command................................................................... 889
40.8. Tcl Procedure Names ...........................................................................................889
41. PL/Perl - Perl Procedural Language.................................................................................. 891
41.1. PL/Perl Functions and Arguments........................................................................ 891
41.2. Data Values in PL/Perl.......................................................................................... 894
41.3. Built-in Functions................................................................................................. 894
41.3.1. Database Access from PL/Perl................................................................. 894
41.3.2. Utility functions in PL/Perl...................................................................... 897
41.4. Global Values in PL/Perl ...................................................................................... 898
41.5. Trusted and Untrusted PL/Perl ............................................................................. 899
41.6. PL/Perl Triggers ...................................................................................................900
41.7. PL/Perl Under the Hood ....................................................................................... 902
41.7.1. Configuration ........................................................................................... 902
41.7.2. Limitations and Missing Features............................................................ 903
42. PL/Python - Python Procedural Language........................................................................ 904
42.1. Python 2 vs. Python 3........................................................................................... 904
42.2. PL/Python Functions ............................................................................................ 905
42.3. Data Values........................................................................................................... 906
42.3.1. Data Type Mapping.................................................................................. 906
42.3.2. Null, None................................................................................................ 907
42.3.3. Arrays, Lists............................................................................................. 908
42.3.4. Composite Types...................................................................................... 908
42.3.5. Set-Returning Functions .......................................................................... 910
42.4. Sharing Data ......................................................................................................... 911
42.5. Anonymous Code Blocks ..................................................................................... 911
42.6. Trigger Functions .................................................................................................912
42.7. Database Access ................................................................................................... 912
42.8. Utility Functions................................................................................................... 913
42.9. Environment Variables ......................................................................................... 914
43. Server Programming Interface .......................................................................................... 915
43.1. Interface Functions ............................................................................................... 915
SPI_connect ......................................................................................................... 915
SPI_finish............................................................................................................. 917
SPI_push .............................................................................................................. 918
SPI_pop................................................................................................................ 919
SPI_execute.......................................................................................................... 920
SPI_exec............................................................................................................... 923
SPI_execute_with_args........................................................................................ 924
SPI_prepare.......................................................................................................... 926
SPI_prepare_cursor.............................................................................................. 928
SPI_prepare_params ............................................................................................ 929
SPI_getargcount................................................................................................... 930
SPI_getargtypeid.................................................................................................. 931
SPI_is_cursor_plan .............................................................................................. 932
SPI_execute_plan................................................................................................. 933
SPI_execute_plan_with_paramlist....................................................................... 935
SPI_execp............................................................................................................. 936
SPI_cursor_open.................................................................................................. 937
xx
剩余2303页未读,继续阅读
2022-03-30 上传
2011-08-07 上传
2022-03-30 上传
2014-02-26 上传
2011-10-29 上传
2012-11-17 上传
2021-09-07 上传
coder_joy
- 粉丝: 0
- 资源: 28
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 探索数据转换实验平台在设备装置中的应用
- 使用git-log-to-tikz.py将Git日志转换为TIKZ图形
- 小栗子源码2.9.3版本发布
- 使用Tinder-Hack-Client实现Tinder API交互
- Android Studio新模板:个性化Material Design导航抽屉
- React API分页模块:数据获取与页面管理
- C语言实现顺序表的动态分配方法
- 光催化分解水产氢固溶体催化剂制备技术揭秘
- VS2013环境下tinyxml库的32位与64位编译指南
- 网易云歌词情感分析系统实现与架构
- React应用展示GitHub用户详细信息及项目分析
- LayUI2.1.6帮助文档API功能详解
- 全栈开发实现的chatgpt应用可打包小程序/H5/App
- C++实现顺序表的动态内存分配技术
- Java制作水果格斗游戏:策略与随机性的结合
- 基于若依框架的后台管理系统开发实例解析
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功