Tải bản đầy đủ (.pdf) (1,753 trang)

Sams PostgreSQL the comprehensive guide to building programming and administering PostgreSQL databases feb 2003 ISBN 0735712573

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (8.23 MB, 1,753 trang )






TableofContents
Index

PostgreSQL
ByKorryDouglas,SusanDouglas

Publisher :SamsPublishing
PubDate :February13,2003
ISBN :0-7357-1257-3
Pages :816
Slots :1



Thedefinitiveguidetoworkingwiththe
powerfulPostgreSQLopensourcedatabase
system.
PostgreSQLleadsthereaderthroughthe
internalsofthepowerfulPostgreSQLopen
sourcedatabase.Throughoutthebook,
readerswillfindexplanationsofdata
structuresandalgorithms,eachbackedbya
concreteexamplefromtheactualsource
code.Eachsectioncontainsinformationabout
performanceimplications,debugging
techniques,andpointerstomoreinformation




(onWebandinbookform).Thereaderwill
findaneasytoread,code-basedapproach
thatmakesiteasytounderstandhoweach
featureisimplemented,howtobestuseeach
feature,andhowtosqueezemore
performancefromdatabaseapplications.
Previouslyannouncedin2/03catalog.Korry
DouglasistheDirectorofResearchand
DevelopmentforAppxSoftware.Overthe
lasttwodecades,hehasworkedonthe
designandimplementationofanumberof
high-levellanguagesanddevelopment
environments.Hisproductsinterfacewith
manyrelational(andnon-relational)
databases.Workingwithmanydifferent
databaseproducts(Oracle,Sybase,SQL
Server,PostgreSQL,MySQL,andMSQL)has
givenhimauniqueunderstandingofthe
commonaltiesof,anddifferencesbetween
databases.







TableofContents

Index

PostgreSQL
ByKorryDouglas,SusanDouglas

Publisher :SamsPublishing
PubDate :February13,2003
ISBN :0-7357-1257-3
Pages :816
Slots :1










Copyright
AbouttheAuthors
AbouttheTechnicalReviewers
AbouttheDevelopmentEditor
Acknowledgments
WeWanttoHearfromYou
ReaderServices
Preface
Introduction
PostgreSQLFeatures


WhatVersionsDoesThisBookCover?



WhatTopicsDoesThisBookCover?


PartI:GeneralPostgreSQLUse
Chapter1.IntroductiontoPostgreSQLandSQL

ASampleDatabase




BasicDatabaseTerminology




ConnectingtoaDatabase




ViewingTableDescriptions

Prerequisites
CreatingTables

AddingNewRecordstoaTable






InstallingtheSampleDatabase




RetrievingDatafromtheSampleDatabase




Multi-TableJoins




DELETE




CreatingNewTablesUsingCREATETABLE...AS




Summary




Aggregates
UPDATE
A(Very)ShortIntroductiontoTransactionProcessing
UsingVIEW

Chapter2.WorkingwithDatainPostgreSQL
NULLValues




CharacterValues




Date/TimeValues




GeometricDataTypes





BLOBs




Sequences




ColumnConstraints




CreatingYourOwnDataTypes




NumericValues
Boolean(Logical)Values
ObjectIDs(OID)
NetworkAddressDataTypes
Arrays
ExpressionEvaluationandTypeConversion
Summary
Chapter3.PostgreSQLSQLSyntaxandUse

PostgreSQLNamingRules




Creating,Destroying,andViewingDatabases




AddingIndexestoaTable




TransactionProcessing






CreatingNewTables
GettingInformationAboutDatabasesandTables
Summary
Chapter4.Performance
HowPostgreSQLOrganizesData
GatheringPerformanceInformation
UnderstandingHowPostgreSQLExecutesaQuery





TableStatistics



PerformanceTips


PartII:ProgrammingwithPostgreSQL
Chapter5.IntroductiontoPostgreSQLProgramming

Server-SideProgramming




Client-SideAPIs




ChoosinganApplicationEnvironment




GeneralStructureofClientApplications
Summary

Chapter6.ExtendingPostgreSQL
ExtendingthePostgreSQLServerwithCustomFunctions




ReturningMultipleValuesfromanExtensionFunction




InternalandExternalForms




DefiningtheDataTypeinC




DefiningtheInputandOutputFunctionsinPostgreSQL



Summary





ExtendingthePostgreSQLServerwithCustomDataTypes
DefiningaSimpleDataTypeinPostgreSQL
DefiningtheInputandOutputFunctionsinC
DefiningtheDataTypeinPostgreSQL

Chapter7.PL/pgSQL
InstallingPL/pgSQL




LanguageStructure




Cursors



Summary

FunctionBody
Triggers




Chapter8.ThePostgreSQLCAPIlibpq





Client1ConnectingtotheServer




Client3SimpleProcessingPQexec()andPQprint()



Summary

Prerequisites
Client2AddingErrorChecking
Client4AnInteractiveQueryProcessor




Chapter9.ASimplerCAPIlibpgeasy



Client1ConnectingtotheServer

Prerequisites





Client2AddingErrorChecking




Client3ProcessingQueries



Summary




Client4AnInteractiveQueryProcessor

Chapter10.ThePostgreSQLC++APIlibpq++
Prerequisites




Client1ConnectingtotheServer




Client3ProcessingQueries




Summary




Client2AddingErrorChecking
Client4AnInteractiveQueryProcessor

Chapter11.EmbeddingSQLCommandsinCProgramsecpg
Prerequisites




Client1ConnectingtotheServer




Client3ProcessingSQLCommands



Summary





Client2AddingErrorChecking
Client4AnInteractiveQueryProcessor

Chapter12.UsingPostgreSQLfromanODBCClientApplication
ODBCArchitectureOverview




Prerequisites




Client2AddingErrorChecking




Client4AnInteractiveQueryProcessor



Resources




Client1ConnectingtotheServer

Client3ProcessingQueries
Summary

Chapter13.UsingPostgreSQLfromaJavaClientApplication
JDBCArchitectureOverview




Prerequisites




Client2AddingErrorChecking




Client4AnInteractiveQueryProcessor





Client1ConnectingtotheServer
Client3ProcessingQueries
Summary
Chapter14.UsingPostgreSQLwithPerl
DBIArchitectureOverview

Prerequisites




Client1ConnectingtotheServer




Client2AddingErrorChecking




Client4AnInteractiveQueryProcessor




Client3ProcessingQueries
Summary
Chapter15.UsingPostgreSQLwithPHP
PHPArchitectureOverview




Prerequisites





Client2AddingErrorChecking




Client4anInteractiveQueryProcessor



Summary




Client1ConnectingtotheServer
Client3QueryProcessing
OtherFeatures

Chapter16.UsingPostgreSQLwithTclandTcl/Tk
Prerequisites




Client1ConnectingtotheServer





Client3AnInteractiveQueryProcessor



Summary




Client2QueryProcessing
ThelibpgtclLarge-ObjectAPI

Chapter17.UsingPostgreSQLwithPython
Python/PostgreSQLInterfaceArchitecture




Prerequisites




Client2AddingErrorChecking





Client4AnInteractiveCommandProcessor

Client1ConnectingtotheServer
Client3QueryProcessing
Summary


PartIII:PostgreSQLAdministration
Chapter18.IntroductiontoPostgreSQLAdministration

Security




UserAccounts




ServerStartupandShutdown




InstallingUpdates

BackupandRestore
Tuning
Localization







Summary
Chapter19.PostgreSQLAdministration
Roadmap(Where'sAllMyStuff?)




InstallingPostgreSQL




ManagingUserAccounts




ArrangingforPostgreSQLStartupandShutdown



Summary









ManagingDatabases
ConfiguringYourPostgreSQLRuntimeEnvironment
BackingUpandCopyingDatabases

Chapter20.InternationalizationandLocalization
LocaleSupport
MultibyteCharacterSets
Summary
Chapter21.Security
SecuringthePostgreSQLDataFiles




SecuringNetworkAccess



Summary



SecuringTables


Index


Copyright
Copyright©2003bySamsPublishing
FIRSTEDITION:February2003
Allrightsreserved.Nopartofthisbookmaybereproducedor
transmittedinanyformorbyanymeans,electronicor
mechanical,includingphotocopying,recording,orbyany
informationstorageandretrievalsystem,withoutwritten
permissionfromthepublisher,exceptfortheinclusionofbrief
quotationsinareview.
LibraryofCongressCatalogCardNumber:2001098750
060504037654321
Interpretationoftheprintingcode:Therightmostdouble-digit
numberistheyearofthebook'sprinting;therightmostsingledigitnumberisthenumberofthebook'sprinting.Forexample,
theprintingcode03-1showsthatthefirstprintingofthebook
occurredin2003.
PrintedintheUnitedStatesofAmerica

Trademarks
Alltermsmentionedinthisbookthatareknowntobe
trademarksorservicemarkshavebeenappropriately
capitalized.SamsPublishingcannotattesttotheaccuracyof
thisinformation.Useofaterminthisbookshouldnotbe
regardedasaffectingthevalidityofanytrademarkorservice
mark.

WarningandDisclaimer



ThisbookisdesignedtoprovideinformationaboutPostgreSQL.
Everyefforthasbeenmadetomakethisbookascompleteand
asaccurateaspossible,butnowarrantyoffitnessisimplied.
Theinformationisprovidedonanas-isbasis.Theauthorsand
SamsPublishingshallhaveneitherliabilitynorresponsibilityto
anypersonorentitywithrespecttoanylossordamagesarising
fromtheinformationcontainedinthisbookorfromtheuseof
thediscsorprogramsthatmayaccompanyit.

Credits
AcquisitionsEditors
StephanieWall
EliseWalter
DevelopmentEditors
ChrisZahn
PaulDuBois
ManagingEditor
CharlotteClapp
SeniorProjectEditor
LoriLyons
CopyEditor
LindaSeifert
SeniorIndexer


CherylLenser
Proofreader
NancySixsmith
Composition

StaceyDeRome
CoverDesigner
AlanClements


AbouttheAuthors
KorryDouglasistheDirectorofResearchandDevelopment
forAppxSoftware.Overthelasttwodecades,hehasworked
onthedesignandimplementationofanumberofhigh-level,
high-productivitylanguagesanddevelopmentenvironments.
Hisproductsinterfacewithmanyrelational(andnon-relational)
databases.Workingwithsomanydifferentdatabaseproducts
(Oracle,Sybase,SQLServer,DB2,PostgreSQL,MySQL,MSQL)
hasgivenhimabroadunderstandingofthecommonalitiesof,
anddifferencesbetween,databases.
SusanDouglasisthePresidentandCEOofConjectrix,Inc.,a
softwarecompanyspecializingindatabasetechnologiesand
securitytools.Consultingtotheend-usercommunityhasgiven
herwidespreaddatabaseexperienceandarealappreciationfor
high-qualityprogramsandflexibletoolspowerfulenoughto
handledatawellandintuitiveenoughtoactuallyuse.
Korryandhiswife(andbestfriend)Susanraisehorsesinrural
Virginia.BotharenativesofthePacificNorthwest,butprefer
thesunshineandopenspacesofferedbyVirginia.Theyboth
telecommute,preferringtospendasmuchtimeaspossiblewith
their200orsoanimalfriends(whonevercomplainaboutbuggy
code,inelegantdesign,orpoorperformance).Susanisanavid
equestrienne;Korrygetstocleanthebarn.



AbouttheTechnicalReviewers
Thesereviewerscontributedtheirconsiderablehands-on
expertisetotheentiredevelopmentprocessforPostgreSQL.As
thebookwasbeingwritten,thesededicatedprofessionals
reviewedallthematerialfortechnicalcontent,organization,
andflow.Theirfeedbackwascriticaltoensuringthat
PostgreSQLfitsourreader'sneedforthehighest-quality
technicalinformation.
BarryStinsongraduatedfromLouisianaStateUniversityin
1995withaMaster'sDegreeinMusicComposition.Duringhis
tenurethere,hewasfortunateenoughtohelpdesignthe
DigitalArtsstudiowithDr.StephenDavidBeck.Designinga
full-fledgedmusicandgraphic-artsdigitalstudioaffordedhim
exposuretoadiversesetofuniquecomputing
systemsparticularlythosefromNeXT,SGI,andApple.
ItwasduringthistimethathediscoveredLinux,and
subsequentlyPostgreSQL,bothofwhichwerestillinanearly
stageofdevelopment.
Aftergraduation,Barrysetuphisownconsultingcompany,
SiliconConsulting,whichisbasedinLafayette,LA.Overthe
years,hehasworkedasaconsultantformanycompanies
throughoutsouthernLouisiana.
Increasingly,muchoftheworkthatBarryhasdoneoverthe
yearshascenteredondatabases.Inthetimefromhisoriginal
exposuretoPostgre95toitspresentformasPostgreSQLan
amazingamountofdevelopmenthastakenplaceonopensourcedatabasesystems.
Theriseofhigh-qualityandopen-sourcedcomputingsystems
thathavetakenplacerecentlyhasproducedarenaissancein
thehigh-techindustry.However,accordingtohisgirlfriend



Pamela,hiscontinuedinsistencetorelyonrenegadeoperating
systems,suchasLinux,hasonlyservedtostrengthenthe
unrulyaspectsalreadypresentinhispersonality.Barryisthe
authorofNewRidersPostgreSQLEssentialReference.
PeterEisentraut,fromDresden,Germany,becameinvolved
withPostgreSQLdevelopmentin1999whenheneededto
scratchtheproverbialitch.(Theresultisthetab-completionin
thepsqlclient.)Hehassinceworkedinmanyareasofthe
PostgreSQLcode,reviewedseveralPostgreSQLbooks,and
contributedtootheropen-sourceprojects.Inhissparetimehe
likestostudyhumanlanguagesandplanstoridehisbicycleto
theplaceswherethoselanguagesarespoken.


AbouttheDevelopmentEditor
Thisreviewerbroughthisgiftforwritingclear,understandable
technicalprosetothisbookinhisroleasDevelopmentEditor.
PaulDuBoisisawriter,databaseadministrator,andleaderin
theopen-sourcecommunity.Heistheauthorofthebest-selling
MySQL,andMySQLandPerlfortheWeb,forNewRiders
Publishing,andMySQLCookbook,Usingcshandtcsh,and
SoftwarePortabilitywithimakeforO'ReillyandAssociates.


Acknowledgments
Thankyoutoourtechnicalreviewers,PeterEisentrautand
BarryStinson,andtoPaulDuBoisforhisdevelopmental
reviewing.Weappreciatetheirmanyhoursspentporing
throughmanuscriptsexposingtechnicalinaccuraciesandpoor

grammar.Theirknowledgeandexpertisehavebeeninvaluable.
ThankyoutothestaffatNewRiders,especiallyChrisZahn,
EliseWalter,andStephanieWallforkeepingthisproject
manageable,ontime,andoncourse.Thehelpandsupportthey
haveprovidedhasmadethisbookpossible.
WewouldespeciallyliketothankthedevelopersofPostgreSQL
fortheyearsofdevelopmentspentproducinganexcellent
database.Withouttheirdevotiontotheproject,itwouldn'thave
evolvedintothemasterpieceweallknowtoday.
Mostofthebooksthatwereadarededicatedtovarious
householdmembersforthelonghoursdevotedtotheirwriting
projectratherthantofamilylife.Instead,wehaveenjoyedthe
longhoursofR&Dspenttogether,interspersedwithscreaming
(duringbreaks,ontheRollerCoastersatKing'sDominionnotat
eachother).


WeWanttoHearfromYou
Asthereaderofthisbook,youareourmostimportantcritic
andcommentator.Wevalueyouropinionandwanttoknow
whatwe'redoingright,whatwecoulddobetter,whatareas
you'dliketoseeuspublishin,andanyotherwordsofwisdom
you'rewillingtopassourway.
Youcanemailorwritemedirectlytoletmeknowwhatyoudid
ordidn'tlikeaboutthisbookaswellaswhatwecandotomake
ourbooksstronger.
PleasenotethatIcannothelpyouwithtechnicalproblems
relatedtothetopicofthisbook,andthatduetothehigh
volumeofmailIreceive,Imightnotbeabletoreplytoevery
message.

Whenyouwrite,pleasebesuretoincludethisbook'stitleand
author,aswellasyournameandcontactinformation.Iwill
carefullyreviewyourcommentsandsharethemwiththeauthor
andeditorswhoworkedonthebook.

Email:



Mail:

MarkTaber
AssociatePublisher
SamsPublishing
201West103rdStreet
Indianapolis,IN46290USA


ReaderServices
FormoreinformationaboutthisbookorothersfromSams
Publishing,visitourWebsiteatwww.samspublishing.com.Type
theISBN(excludinghyphens)orthetitleofthebookinthe
Searchboxtofindthebookyou'relookingfor.


Preface
Thesedays,itseemsthatmostdiscussionofopen-source
softwarecentersontheideathatyoushouldnothavetotie
yourfuturetothewhimofsomegiantcorporation.Peoplesay
thatopen-sourcesoftwareisbetterthanproprietarysoftware

becauseitisdevelopedandmaintainedbytheusersinsteadof
afacelesscompanyouttolightenyourwallet.
Ithinkthattherealvalueinfreesoftwareiseducation.Ihave
neverlearnedanythingbyreadingmyowncode[1].Ontheother
hand,it'sarareoccasionwhenI'velookedatcodewrittenby
someoneelseandhaven'tcomeawaywithanothertoolinmy
toolkit.Peopledon'tthinkalike.Idon'tmeanthatpeople
disagreewitheachother;Imeanthatpeoplesolveproblemsin
differentways.Eachpersonbringsauniquesetofexperiences
tothetable.Eachpersonhashisownsetofgoalsandbiases.
Eachpersonhashisowninterests.Allthesethingswillshape
thewayyouthinkaboutaproblem.Often,I'llfindmyselfina
heateddisagreementwithacolleagueonlytorealizethatwe
areeachcorrectinourapproach.JustbecauseI'mright,
doesn'tmeanthatmycolleaguecan'tberightaswell.
[1]MaybeIshouldsaythatIhaveneverlearnedanythingnewbyreadingmyowncode.I've
certainlylookedatcodethatI'vewrittenandwonderedwhatIwasthinkingatthetime,learning
thatI'mnotnearlyascleverasIhadremembered.Oddlyenough,thosewhohavereadmycode
havereachedasimilarconclusion.

Open-sourcesoftwareisagreatwaytolearn.Youcanlearn
aboutprogramming.Youcanlearnaboutdesign.Youcanlearn
aboutdebugging.Sometimes,you'lllearnhownottodesign,
code,ordebug;butthat'savaluablelessontoo.Youcanlearn
smallthings,suchashowtocachefiledescriptorsonsystems
wherefiledescriptorsareascarceandexpensiveresource,or
howtousetheselect()functiontoimplementfine-grained
timers.Youcanlearnbigthings,likehowaqueryoptimizer



worksorhowtowriteaparser,orhowtodevelopagood
memorymanagementstrategy.
PostgreSQLisagreatexample.I'vebeenusingdatabasesfor
thelasttwodecades.I'veusedmostofthemajorcommercial
databases:Oracle,Sybase,DB2,andMSSQLServer.Witheach
commercialdatabase,thereisawallofknowledgebetweenmy
needsandthevendor'sneedtoprotecthisintellectualproperty.
UntilIstartedexploringopen-sourcedatabases,Ihadan
incompleteunderstandingofhowadatabaseworks.Whywas
thisparticularfeatureimplementedthatway?WhyamIgetting
poorperformancewhenItrythis?That'saneatfeature;I
wonderhowtheydidthat?Everycommercialdatabasetriesto
exposeasmallpieceofitsinnerworkings.Theexplain
statementwillshowyouwhythedatabasemakesits
optimizationdecisions.But,youonlygettoseewhatthevendor
wantsyoutosee.Thevendorisn'ttryingtohidethingsfrom
you(inmostcases),butwithoutcompleteaccesstothesource
code,theyhavetopickandchoosehowtoexposeinformation
inameaningfulway.Withopensourcesoftware,youcandive
deepintothesourcecodeandpulloutalltheinformationyou
need.Whilewritingthisbook,I'vespentalotoftimereading
throughthePostgreSQLsourcecode.I'veaddedalotofmy
owncodetorevealmoreinformationsothatIcouldexplain
thingsmoreclearly.Ican'tdothatwithacommercialdatabase.
Therearegemsofbrillianceinmostopen-sourceprojects.Ina
well-designed,well-factoredproject,youwillfinddesignsand
codethatyoucanuseinyourownprojects.Manyopensource
projectsarestartingtosplittheircodeintoreusablelibraries.
TheApachePortableRuntimeisagoodexample.TheApache
Webserverrunsonmanydiverseplatforms.TheApache

developmentteamsawtheneedforalayerofabstractionthat
wouldprovideaportableinterfacetosystemfunctionssuchas
sharedmemoryandnetworkaccess.Theydecidedtofactorthe
portabilitylayerintoalibraryseparatefromtheirmainproject.
TheresultistheApachePortableRuntime-alibraryofcode


thatcanbeusedinotheropen-sourceprojects(suchas
PostgreSQL).
Somedevelopershatetoworkonsomeoneelse'scode.Ilove
workingoncodewrittenbyanotherdeveloperIalwayslearn
somethingfromtheexperience.Istronglyencourageyouto
diveintothePostgreSQLsourcecode.Youwilllearnfromit.You
mightevendecidetocontributetotheproject.


Introduction
PostgreSQLisarelationaldatabasewithalonghistory.Inthe
late1970s,theUniversityofCaliforniaatBerkeleybegan
developmentofPostgreSQL'sancestorarelationaldatabase
knownasIngres.RelationalTechnologiesturnedIngresintoa
commercialproduct.RelationalTechnologiesbecameIngres
CorporationandwaslateracquiredbyComputerAssociates.
Around1986,MichaelStonebrakerfromUCBerkeleyledateam
thataddedobject-orientedfeaturestothecoreofIngres;the
newversionbecameknownasPostgres.Postgreswasagain
commercialized;thistimebyacompanynamedIllustra,which
becamepartoftheInformixCorporation.AndrewYuandJolly
ChenaddedSQLsupporttoPostgresinthemid-90s.Prior
versionshadusedadifferent,Postgres-specificquerylanguage

knownasPostquel.In1996,manynewfeatureswereadded,
includingtheMVCCtransactionmodel,moreadherencetothe
SQL92standard,andmanyperformanceimprovements.
Postgresonceagaintookonanewname:PostgreSQL.
Today,PostgreSQLisdevelopedbyaninternationalgroupof
open-sourcesoftwareproponentsknownasthePostgreSQL
GlobalDevelopmentgroup.PostgreSQLisanopen-source
productitisnotproprietaryinanyway.RedHathasrecently
commercializedPostgreSQL,creatingtheRedHatDatabase,but
PostgreSQLitselfwillremainfreeandopen-source.


PostgreSQLFeatures
PostgreSQLhasbenefitedwellfromitslonghistory.Today,
PostgreSQLisoneofthemostadvanceddatabaseservers
available.Hereareafewofthefeaturesfoundinastandard
PostgreSQLdistribution:
Object-relationalInPostgreSQL,everytabledefinesaclass.
PostgreSQLimplementsinheritancebetweentables(or,if
youlike,betweenclasses).Functionsandoperatorsare
polymorphic.
StandardscompliantPostgreSQLsyntaximplementsmost
oftheSQL92standardandmanyfeaturesofSQL99.Where
differencesinsyntaxoccur,theyaremostoftenrelatedto
featuresuniquetoPostgreSQL.
OpensourceAninternationalteamofdevelopersmaintains
PostgreSQL.Teammemberscomeandgo,butthecore
membershavebeenenhancingPostgreSQL'sperformance
andfeaturesetsinceatleast1996.Oneadvantageto
PostgreSQL'sopen-sourcenatureisthattalentand

knowledgecanberecruitedasneeded.Thefactthatthis
teamisinternationalensuresthatPostgreSQLisaproduct
thatcanbeusedproductivelyinanynaturallanguage,not
justEnglish.
TransactionprocessingPostgreSQLprotectsdataand
coordinatesmultipleconcurrentusersthroughfull
transactionprocessing.Thetransactionmodelusedby
PostgreSQLisbasedonmulti-versionconcurrencycontrol
(MVCC).MVCCprovidesmuchbetterperformancethanyou
wouldfindwithotherproductsthatcoordinatemultiple
usersthroughtable-,page-,orrow-levellocking.


ReferentialintegrityPostgreSQLimplementscomplete
referentialintegritybysupportingforeignandprimarykey
relationshipsaswellastriggers.Businessrulescanbe
expressedwithinthedatabaseratherthanrelyingonan
externaltool.
MultipleprocedurallanguagesTriggersandother
procedurescanbewritteninanyofseveralprocedural
languages.Server-sidecodeismostcommonlywrittenin
PL/pgSQL,aprocedurallanguagesimilartoOracle's
PL/SQL.Youcanalsodevelopserver-sidecodeinTcl,Perl,
evenbash(theopen-sourceLinux/Unixshell).
Multiple-clientAPIsPostgreSQLsupportsthedevelopment
ofclientapplicationsinmanylanguages.Thisbook
describeshowtointerfacetoPostgreSQLfromC,C++,
ODBC,Perl,PHP,Tcl/Tk,andPython.
UniquedatatypesPostgreSQLprovidesavarietyofdata
types.Besidestheusualnumeric,string,anddatetypes,

youwillalsofindgeometrictypes,aBooleandatatype,and
datatypesdesignedspecificallytodealwithnetwork
addresses.
ExtensibilityOneofthemostimportantfeaturesof
PostgreSQListhatitcanbeextended.Ifyoudon'tfind
somethingthatyouneed,youcanusuallyaddityourself.
Forexample,youcanaddnewdatatypes,newfunctions
andoperators,andevennewproceduralandclient
languages.Therearemanycontributedpackagesavailable
ontheInternet.Forexample,RefractionsResearch,Inc.
hasdevelopedasetofgeographicdatatypesthatcanbe
usedtoefficientlymodelspatial(GIS)data.


WhatVersionsDoesThisBookCover?
Thisbookhasbeeninprogressforalmostayearandthe
PostgreSQLdevelopmentteamhasnotbeenidleduringthat
year.WhenIstartedworkingonthisbook,PostgreSQLversion
7.1.2wasonthestreets.Abouthalfwaythrough,PostgreSQL
version7.2wasreleasedandthedevelopmentteamhad
startedworkingonnewfeaturesforversion7.3.
Fortunately,thePostgreSQLdeveloperstryveryhardto
maintainforwardcompatibilitynewfeaturestendnottobreak
existingapplications.Thismeansthatallthe7.1.2and7.2
featuresdiscussedinthisbookshouldstillbeavailableand
substantiallysimilarinlaterversionsofPostgreSQL.Ihavetried
toavoidtalkingaboutfeaturesthathavenotbeenreleasedat
thetimeofwritingwhereIhavementionedfuture
developments,Iwillpointthemout.


WhoIsThisBookFor?
IfyouarealreadyusingPostgreSQL,youshouldfindthisbooka
usefulguidetosomeofthefeaturesthatyoumightbeless
familiarwith.Thefirstpartofthebookprovidesanintroduction
toSQLandPostgreSQLforthenewuser.You'llalsofind
informationthatshowshowtoobtainandinstallPostgreSQLon
aUnix/Linuxhost,aswellasonMicrosoftWindows.
Ifyouaredevelopinganapplicationthatwillstoredatain
PostgreSQL,thesecondpartofthisbookwillprovideyouwitha
greatdealofinformationrelatingtoPostgreSQLprogramming.
You'llfindinformationonbothserver-sideandclient-side
programminginavarietyoflanguages.
Everydatabaseneedsoccasionaladministrativework.Thefinal


×