PHP Manual
PEAR Manual
Smarty Manual
PostgreSQL
MySQL Manual
Perl Manual
Ciekawe adresy
- Kursy Finansowe
- ERP
- Ubezpieczenie pojazdu
- Biuro rachunkowe Opole
- Projekty Domów Jednorodzinnych
- Ubezpieczenia Komunikacyjne
- Nawigacja
- Deweloper
- Szkolenia
Czytnik RSS
» DRM Ubisoftu: hakerzy atakują, serwery padają, gracze protestująNowatorski system zabezpieczeń DRM zastosowany przez Ubisoft w najnowszych grach Silent Hunter 5: Battle of the Atlantic oraz Assassin's Creed 2 jak na razie powoduje więcej problemów legalnym użytkownikom niż piratom. Na forach pomocy technicznej firmy roi się od postów graczy wściekłych na niestabilność serwerów, która uniemożliwia zabawę.
» HP Mini 210 Vivienne Tam - netbook w motylki
Netbook jako cyfrowy dodatek do damskiej garderoby? Dlaczego nie. Zobacz, jak najnowsza wersja komputera HP Mini 210 Vivienne Tam komponuje się z ubiorem.
» Kobieta w sieci
Stanowią niemal połowę użytkowników polskiego internetu, preferują serwisy społecznościowe, witryny poświęcone stylowi życia, turystyce i edukacji, a coraz częściej także strony o tematyce informacyjnej oraz biznesowej. Jakie jeszcze są internautki? - oto krótka charakterystyka na podstawie wybranych badań i raportów.
» Sony udostępnia pierwszą "facebookową" grę
Sony Online Entertainment wydało swoją pierwszą grę przeznaczoną dla użytkowników serwisu społecznościowego Facebook. Nosi ona tytuł PoxNora.
practical postgresql

now shipping!
john worsley
joshua drake
edited by
andrew brookins
michael holloway
copyright © 2001 by commandprompt, inc
copyright (c) 2001 by command prompt, inc. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/).
'distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder.' to the license reference or copy.
'distribution of the work or derivative of the work in any standard (paper) book form is prohibited unless prior permission is obtained from the copyright holder.' to the license reference or copy.
although every reasonable effort has been made to incorporate accurate and useful information into this book, the copyright holders make no representation about the suitability of this book or the information therein for any purpose. it is provided "as is" without expressed or implied warranty.
- table of contents
- preface
- i. introduction and installation
- ii. using postgresql
- iii. administrating postgresql
- iv. programming with postgresql
- v. postgresql command reference
-
- 14. postgresql command reference
-
- abort -- rolls back changes made during a transaction block.
- alter group -- modifies the structure of a user group.
- alter table -- modifies table and column attributes.
- alter user -- modifies user properties and permissions.
- begin -- starts a chained-mode transaction block.
- close -- closes a previously defined cursor object.
- cluster -- provides the backend server with clustering information about a table.
- comment -- adds a comment to an object within the database.
- commit -- ends the current transaction block and finalizes changes made within it.
- copy -- copies data between files and tables.
- create aggregate -- defines a new aggregate function within the database.
- create database -- creates a new database in postgresql.
- create function -- defines a new function within the database.
- create group -- creates a new postgresql group within the database.
- create index -- places an index on a table.
- create language -- defines a new language to be used by functions.
- create operator -- defines a new operator within the database.
- create rule -- defines a new rule on a table.
- create sequence -- creates a new sequence number generator.
- create table -- creates a new table.
- create table as -- creates a new table built from data retrieved by a select.
- create trigger -- creates a new trigger.
- create type -- defines a new data type for use in the database.
- create user -- creates a new postgresql database user.
- create view -- creates a view on a table.
- current_date -- returns the current date.
- current_time -- returns the current time.
- current_timestamp -- returns the current date and time.
- current_user -- returns the current database username.
- declare -- defines a new cursor.
- delete -- removes rows from a table.
- drop aggregate -- removes an aggregate function from a database.
- drop database -- removes a database from the system.
- drop function -- removes a user-defined function.
- drop group -- removes a user group from the database.
- drop index -- removes an index from a database.
- drop language -- removes a procedural language from a database.
- drop operator -- removes an operator from the database.
- drop rule -- removes a rule from a database.
- drop sequence -- removes a sequence from a database.
- drop table -- removes a table from a database.
- drop trigger -- removes a trigger definition from a database.
- drop type -- removes a type from the system catalogs.
- drop user -- removes a postgresql user.
- drop view -- removes an existing view from a database.
- end -- ends the current transaction block and finalizes its modifications.
- explain -- shows the statement execution plan for a supplied query.
- fetch -- retrieves rows from a cursor.
- grant -- grants access privileges to a user, a group, or to all users in the database.
- insert -- inserts new rows into a table.
- listen -- listen for a notification event.
- load -- dynamically loads object files into a database.
- lock -- locks a table within a transaction.
- move -- repositions a cursor to another row.
- notify -- signals all backends that are listening for the specified notify event.
- reindex -- rebuilds indices on tables.
- reset -- restores runtime variables to their default settings.
- revoke -- revokes access privileges from a user, a group, or all users.
- rollback -- aborts the current transaction block and abandons any modifications it would have made.
- select -- retrieves rows from a table or view.
- select into -- construct a new table from the results of a select.
- set -- set runtime variables.
- set constraints -- sets the constraint mode for the current transaction block.
- set transaction -- sets the transaction isolation level for the current transaction block.
- show -- displays the values of runtime variables.
- truncate -- empties the contents of a table.
- unlisten -- stops the backend process from listening for a notification event.
- update -- modifies the values of column data within a table.
- vacuum -- cleans and analyzes a database.
- vi. appendixes
- list of tables
- 3-1. an example sql table
- 3-2. fundamental postgresql commands
- 3-3. postgresql supported c-style escape sequences
- 3-4. floating-point representations
- 3-5. punctuation symbols
- 3-6. fundamental postgresql operators
- 3-7. a simple sql query
- 3-8. update example: the set clause
- 3-9. update example: the where clause
- 3-10. postgresql supported data types
- 3-11. supported true or false constants
- 3-12. character types
- 3-13. numeric types overview
- 3-14. date and time types
- 3-15. valid date formats
- 3-16. month abbreviations
- 3-17. day of the week abbreviations
- 3-18. date output formats
- 3-19. extended date output formats
- 3-20. valid time formats
- 3-21. valid time zone formats
- 3-22. some valid timestamp formats
- 3-23. date and time constants
- 3-24. geometric types
- 3-25. system columns
- 3-26. the authors table
- 3-27. the subjects table
- 4-1. the shipments table
- 5-1. basic character string operators
- 5-2. regular expression comparison operators
- 5-3. regular expression symbols
- 5-4. mathematical operators
- 5-5. comparison operators
- 5-6. bit-string operators
- 5-7. the and, or, and not operators
- 5-8. operator precedence
- 5-9. mathematical functions in postgresql
- 5-10. character string functions
- 5-11. date and time functions
- 5-12. timestamp and interval units
- 5-13. type conversion functions
- 5-14. numeric conversion formatting characters
- 5-15. timestamp conversion formatting characters
- 5-16. aggregate functions
- 6-1. default prompt settings
- 6-2. prompt substitution characters
- 7-1. sequence attributes
- 7-2. the shipments table
- 7-3. the pg_trigger table
- 8-1. the pg_shadow table
- 10-1. the pg_shadow table
- 10-2. postgresql acl privileges
- 10-3. the stock table
- 11-1. possible level values
- 11-2. trigger function variables
- 13-1. lxp inclusion methods
- 13-2. database connection attributes
- 14-1. operator/index correspondence
- a-1. multibyte encoding types
- list of figures
- 6-1. pgaccess application window
- 6-2. the pgaccess users tab
- 6-3. the pgaccess create new table dialog box
- 6-4. the pgaccess visual query designer
- 6-5. the function dialog box
- list of examples
- 2-1. verifying gnu make
- 2-2. verifying gcc
- 2-3. verifying gzip and tar
- 2-4. verifying disk space
- 2-5. adding the postgres user
- 2-6. unpacking the postgresql source package
- 2-7. compiling the source with gnu make
- 2-8. making regression tests
- 2-9. regression check output
- 2-10. the gmake install command
- 2-11. installing perl and python modules manually
- 2-12. installing all headers
- 2-13. setting ld_library_path in a bash shell
- 2-14. setting ld_library_path in csh and tcsh
- 2-15. initializing the database
- 2-16. output from initdb
- 2-17. running postmaster in the foreground
- 2-18. running postmaster in the background
- 2-19. copying the linux script
- 2-20. making the linux script executable
- 2-21. starting postgresql with the sysv script
- 2-22. creating a database
- 2-23. accessing a database with psql
- 2-24. querying a system table
- 3-1. spaces and newlines
- 3-2. keywords and commands
- 3-3. bending rules
- 3-4. using string constants
- 3-5. multiline string constants
- 3-6. using bit string constants
- 3-7. using integer constants
- 3-8. valid floating-point values
- 3-9. the difference between true and 'true'
- 3-10. operators in statements
- 3-11. single-line comments
- 3-12. multiline comments
- 3-13. example sql query
- 3-14. a sql update
- 3-15. observing null values
- 3-16. using null values
- 3-17. simple boolean table
- 3-18. checking boolean values
- 3-19. implying boolean 'true'
- 3-20. checking for 'false' boolean values
- 3-21. correcting null values
- 3-22. avoiding overflow errors
- 3-23. a numeric alternative to money
- 3-24. using the serial data type
- 3-25. accomplishing the same goal manually
- 3-26. setting date formats
- 3-27. interpreting interval formats
- 3-28. using the current and now constants
- 3-29. comparing now to current
- 3-30. using type conversion functions
- 3-31. differentiating rows via the oid
- 4-1. setting system path for psql
- 4-2. listing psql slash commands
- 4-3. entering statements into psql
- 4-4. leaving end-characters open
- 4-5. setting the editor variable
- 4-6. creating the books table
- 4-7. the \d command's output
- 4-8. adding a column
- 4-9. altering column defaults
- 4-10. renaming a table
- 4-11. renaming a column
- 4-12. adding constraints to a table
- 4-13. changing table ownership
- 4-14. restructuring a table with create table as
- 4-15. restructuring a table with create table and insert into
- 4-16. inserting new values into the books table
- 4-17. changing the order of target columns
- 4-18. inserting values from another table
- 4-19. an example ascii copy file
- 4-20. copying an ascii file
- 4-21. copying a binary file
- 4-22. copying the books table to an ascii file
- 4-23. selecting all from the books table
- 4-24. re-ordering columns
- 4-25. using expressions and constants
- 4-26. using the as clause with expressions and constants
- 4-27. selecting from multiple table sources
- 4-28. selecting from a sub-query
- 4-29. aliasing from sources
- 4-30. aliasing columns
- 4-31. using distinct
- 4-32. a simple where clause
- 4-33. combining conditions in the where clause
- 4-34. grouping where conditions with parentheses
- 4-35. a simple cross join
- 4-36. comparing inner join to where
- 4-37. the natural and using clauses
- 4-38. inner joins versus outer joins
- 4-39. joining many data sources
- 4-40. using group by
- 4-41. using the having clause
- 4-42. using order by
- 4-43. using order by with multiple expressions
- 4-44. using distinct with order by
- 4-45. using limit and offset
- 4-46. using union
- 4-47. using intersect
- 4-48. using except
- 4-49. comparing sub-query result sets
- 4-50. using case expressions in statements
- 4-51. using case expressions with sub-queries
- 4-52. using select into
- 4-53. a simple update
- 4-54. updating entire columns
- 4-55. using update on several columns
- 4-56. using update with several sources
- 4-57. deleting rows from a table
- 4-58. deleting all table rows
- 4-59. a simple sub-query
- 4-60. a sub-query using in
- 4-61. a multi-column sub-query using in
- 4-62. creating a view
- 4-63. using a view
- 5-1. correct operator usage
- 5-2. incorrect operator usage
- 5-3. comparing strings
- 5-4. concatenating strings
- 5-5. an example regular expression
- 5-6. a simple regular expression comparison
- 5-7. a more involved regular expression comparison
- 5-8. a complicated regular expression comparison
- 5-9. using mathematical operators
- 5-10. using comparison operators
- 5-11. using between
- 5-12. operator equivalents to between
- 5-13. shifting bit strings
- 5-14. combining comparisons with boolean operators
- 5-15. comparisons using is null
- 5-16. comparisons equal to null
- 5-17. using operators with null values
- 5-18. operator precedence
- 5-19. using aggregate expressions
- 6-1. inserting a file into the current buffer
- 6-2. setting a variable
- 6-3. the variable list
- 6-4. using interpolation during an insert
- 6-5. reading from a file into a variable
- 6-6. using a variable in an insert
- 6-7. setting the prompt variables
- 6-8. customizing the prompt with database host, port, and username
- 6-9. customizing the prompt with the date, database name, and username
- 7-1. creating an index
- 7-2. implicit index creation
- 7-3. creating a unique index
- 7-4. specifying an index type
- 7-5. creating a functional index
- 7-6. dropping an index
- 7-7. creating a table with column constraints
- 7-8. creating a table with table constraints
- 7-9. adding a constraint to an existing table
- 7-10. removing a constraint
- 7-11. creating a child table
- 7-12. inserting into a child table
- 7-13. selecting with inheritance
- 7-14. modifying parent and child tables
- 7-15. modifying parent tables with only
- 7-16. creating a table with an array column
- 7-17. creating a table with a multidimensional array column
- 7-18. inserting array constants
- 7-19. inserting values into multidimensional arrays
- 7-20. selecting entire array values
- 7-21. selecting array values with subscripts
- 7-22. avoiding null values in arrays
- 7-23. selecting from a multi-dimensional array
- 7-24. selecting array values with slices
- 7-25. using array_dims( )
- 7-26. completely modifying an array
- 7-27. modifying an array subscript
- 7-28. creating a sequence
- 7-29. viewing a sequence
- 7-30. incrementing a sequence
- 7-31. using currval( )
- 7-32. setting a sequence value
- 7-33. removing a sequence
- 7-34. checking sequence dependencies
- 7-35. creating the check_shipment trigger
- 7-36. dropping a trigger
- 7-37. selecting a trigger's assigned table
- 7-38. beginning a transaction
- 7-39. committing a transaction
- 7-40. rolling back a transaction
- 7-41. recovering from the abort state
- 7-42. declaring a cursor
- 7-43. fetching rows from a cursor
- 7-44. moving a cursor
- 7-45. closing a cursor
- 7-46. creating a sql function
- 7-47. using a sql function
- 7-48. is_zero.c, a simple c function
- 7-49. creating a c function
- 7-50. overloading a c function
- 7-51. using a c function
- 7-52. dropping a function
- 7-53. creating a user-defined operator
- 7-54. using a user-defined operator
- 7-55. overloading a user-defined operator
- 7-56. using an overloaded operator
- 7-57. dropping an operator
- 7-58. dropping an overloaded operator
- 8-1. a simple pg_hba.conf file
- 8-2. checking user permissions
- 8-3. a valid pg_hba.conf entry with spaces and tabs
- 8-4. valid pg_hba.conf comments
- 8-5. host entry syntax
- 8-6. single host entry
- 8-7. rejection entry
- 8-8. single host, single database entry
- 8-9. small network connection entry
- 8-10. larger network connection entry
- 8-11. an ident configuration in pg_hba.conf
- 8-12. a pg_ident.conf configuration
- 8-13. a sameuser configuration
- 8-14. making an ssh tunnel to postgresql
- 8-15. using stunnel remotely
- 8-16. using stunnel locally
- 8-17. an example inetd entry
- 8-18. an example xinetd entry
- 9-1. starting postgresql with pg_ctl
- 9-2. stopping postgresql with pg_ctl
- 9-3. restarting postgresql with pg_ctl
- 9-4. checking status with pg_ctl
- 9-5. starting postgresql with service command
- 9-6. checking status with postgresql script
- 9-7. initializing a new database cluster
- 9-8. initializing a secondary database location
- 9-9. checking usecreatedb rights
- 9-10. creating a database
- 9-11. using the createdb application
- 9-12. using drop database
- 9-13. using the dropdb command
- 9-14. using vacuum on a table
- 9-15. using vacuum analyze on a database
- 9-16. using vacuumdb on all databases
- 9-17. using vacuumdb on a remote database
- 9-18. commenting the books table
- 9-19. retrieving a comment
- 9-20. using pg_dump
- 9-21. using pg_dump remotely
- 9-22. using pg_dumpall
- 9-23. recreating the booktown database
- 9-24. restore with pg_restore
- 9-25. backing up the postgresql filesystem
- 10-1. creating a normal user
- 10-2. creating a user with createdb rights
- 10-3. creating a superuser
- 10-4. creating a user with createuser
- 10-5. interactively creating a user with createuser
- 10-6. resetting a password
- 10-7. adding superuser rights
- 10-8. removing superuser rights
- 10-9. removing a user with drop user
- 10-10. removing a user with dropuser
- 10-11. creating a group
- 10-12. verifying a group
- 10-13. removing a group
- 10-14. adding a user to a group
- 10-15. verifying user addition
- 10-16. removing a user from a group
- 10-17. granting user privileges
- 10-18. granting group privileges
- 10-19. revoking rights
- 10-20. controlling select privileges with a view
- 10-21. controlling select
- 11-1. creating the pl/pgsql call handler
- 11-2. adding pl/pgsql with create language
- 11-3. using createlang as a database superuser
- 11-4. explicitly passing a superuser account name to createlang
- 11-5. structure of a pl/pgsql code block
- 11-6. using single-line comments
- 11-7. using block comments
- 11-8. using expressions
- 11-9. output of a_ function( )
- 11-10. using timestamp values correctly
- 11-11. declaring a pl/pgsql variable
- 11-12. variable declarations
- 11-13. using variable declaration options
- 11-14. default value assignment
- 11-15. using the select into statement
- 11-16. result of the get_customer_id( ) function
- 11-17. using select into with multiple columns
- 11-18. result of the get_customer_name( ) function
- 11-19. using the found boolean in get_customer_id( )
- 11-20. result of the new get_customer_id( ) function
- 11-21. function call examples
- 11-22. directly using argument variables
- 11-23. syntax of the alias keyword
- 11-24. using pl/pgsql aliases
- 11-25. result of the triple_price( ) function
- 11-26. syntax of the return statement
- 11-27. declaring a variable using %type
- 11-28. using the %type attribute
- 11-29. results of the get_author( ) function
- 11-30. using the %rowtype attribute
- 11-31. results of the new get_author( ) function
- 11-32. returning a concatenated string
- 11-33. assigning a concatenated value to a string
- 11-34. syntax of an if/then statement
- 11-35. using the if/then statement
- 11-36. results of the stock_amount( ) function
- 11-37. syntax of an if/then/else statement
- 11-38. using the if/then/else statement
- 11-39. results of the in_stock( ) function
- 11-40. using the if/then/else/if statement
- 11-41. results of the books_by_subject() function
- 11-42. using the basic loop
- 11-43. result of the square_integer_loop( ) function
- 11-44. using the while loop
- 11-45. using the for loop
- 11-46. using the for loop with %rowtype
- 11-47. result of the extract_title() function
- 11-48. using the raise statement
- 11-49. results of the raise_test( ) function
- 11-50. syntax of the perform keyword
- 11-51. using the perform keyword
- 11-52. creating trigger functions
- 11-53. the check_shipment_addition() pl/pgsql trigger function
- 11-54. the check_shipment trigger
- 12-1. class name lookup
- 12-2. a simple jdbc connection
- 12-3. a jdbc statement object
- 12-4. a simple jdbc select
- 12-5. a simple jdbc insert
- 12-6. a jdbc prepared statement
- 12-7. jdbc resultsetmetadata
- 12-8. jdbc databasemetadata
- 12-9. jdbc first row fetch
- 13-1. installing lxp with lxpinstall.sh
- 13-2. manually installing liblxp.so
- 13-3. manually installing libpq.so.2.2
- 13-4. manually installing lxp.conf
- 13-5. configuring httpd.conf for lxp
- 13-6. a simple lxp mark-up region
- 13-7. displaying a cookie value
- 13-8. substituting cookie values
- 13-9. invalid variable substitution
- 13-10. valid variable substitution
- 13-11. using entity substitution
- 13-12. using <varparser> to prepare sql
- 13-13. using the <if> tag
- 13-14. using the <ifnot> tag
- 13-15. using nested logic
- 13-16. using ifcookie and ifnotcookie
- 13-17. using the <else> tag
- 13-18. using nested logic with <else> tags
- 13-19. a simple <for> loop
- 13-20. handling array results with <for>
- 13-21. including an lxp document
- 13-22. including flat files
- 13-23. including a token-delimited file
- 13-24. including an xml file
- 13-25. including an rdf file
- 13-26. including other content types
- 13-27. connecting to a non-default database
- 13-28. including sql content
- 13-29. using sql object variable values
- 13-30. selecting sql results into an lxp object
- 13-31. using <xtag> for empty elements
- 13-32. using nested <xtag> elements
Najskuteczniejsza reklama to pozycjonowanie - Pozycjonowanie stron <= zajrzyj tu i dowiedz się więcej o pozycjonowanie stron