pgadmin iii 1.16.1 documentation · pgadmin iii contents: introduction using pgadmin iii pgadmin...

242
index next | pgAdmin III 1.16.1 documentation »

Upload: others

Post on 01-Nov-2019

57 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|pgAdminIII1.16.1documentation»

Page 2: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminIIIContents:

IntroductionUsingpgAdminIII

pgAdminMainWindowConnecttoserverChangePasswordControlServerQuerytoolpgAdminDebuggerpgAdminDataExportEditDataMaintainadatabaseobjectBackupRestoreGrantWizardReportToolDatabaseServerStatuspgAdminOptionsGuruHintsCommandLineParameters

pgAgentpgAgentInstallationpgAgentJobspgAgentSchedulespgAgentSteps

Slony-IsupportSlony-IwithpgAdminIIIoverviewSlony-IadministrationwithpgAdminIII:installationCreatingpathsandlistensCreatingsetsandsubscriptions

Page 3: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ExecuteDDLscriptswithSlony-ISlony-ItasksSlony-Iexample

ExtendedfeaturesAppendices

BugReportingThepgAdminDevelopmentTeamTranslationteamThePostgreSQLLicenceTheMITKerberosLicenceTheOpenSSLLicence

indexnext|pgAdminIII1.16.1documentation»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 4: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»

Page 5: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

IntroductionpgAdmin III is a comprehensive PostgreSQLdatabase design andmanagement system for Unix and Windows systems. It is freelyavailableunderthetermsoftheThePostgreSQLLicenceandmaybe redistributed provided the terms of the licence are adhered to.TheprojectismanagedbytheThepgAdminDevelopmentTeam.

This software was written as a successor to the original pgAdminandpgAdminIIproducts,whichthoughpopular,hadlimitationsinthedesignthatpreventedthembeingtakentothe‘nextlevel’.pgAdminIII is written in C++ and uses the excellent wxWidgets (formerlywxWindows) cross platform toolkit. Connection to PostgreSQL ismadeusingthenativelibpqlibrary.

indexnext|previous|pgAdminIII1.16.1documentation»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 6: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»

Page 7: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

UsingpgAdminIIIThis section explains how you can use pgAdmin tomaintain yourPostgreSQLdatabases.pgAdminsupportsdatabaseserverversions7.3andup.Versionsolder than7.3arenot supported, pleaseusepgAdminIIforthese.

Contents:

pgAdminMainWindowGettingstarted

ConnecttoserverConnectionerrors

ChangePasswordGoodpractice

ControlServerQuerytool

GraphicalQuerybuilderpgAdminDataExportQueryToolMacrospgScriptScriptingLanguageReference

pgAdminDebuggerpgAdminDataExportEditData

ViewDataOptionsMaintainadatabaseobject

VACUUMANALYZEREINDEX

BackupRestoreGrantWizardReportTool

DefaultXSLStylesheet

Page 8: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

DatabaseServerStatuspgAdminOptions

pgAdminBrowserOptionspgAdminQuerytoolOptionspgAdminDatabaseDesignerOptionspgAdminServerStatusOptionspgAdminMiscellaneousOptions

GuruHintsCommandLineParameters

When editing the properties of a database object, pgAdmin willsupport you with help about the underlying PostgreSQL SQLcommands,ifyoupresstheF1functionkey.Inorderforthistowork,theSQLhelpsitesettingintheoptionsdialogmustbesetcorrectly.

indexnext|previous|pgAdminIII1.16.1documentation»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 9: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 10: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminMainWindow

Inthemainwindow,thestructureofthedatabasesisdisplayed.Youcan create new objects, delete and edit existing objects if theprivilegesoftheuserthatyouareusingonthecurrentconnectiontothedatabaseallowthis.

Theleftsideofthemainwindowshowsatreewithallservers,andtheobjectstheycontain.

Theupperrightsideshowsdetailsoftheobjectcurrentlyselectedin

Page 11: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

the tree. Some objects might have statistics in addition to theirproperties,thesecanbeshownifyouselecttheStatisticstab.

ThelowerrightsidecontainsareverseengineeredSQLscript.Youcancopythistoanyeditorusingcut&paste,orsaveittoafileusingSavedefinition... from theFilemenu,oruse itasa template ifyouselect theQueryTool. If theCopySQLfrommainwindowtoquerytooloptionisselected,theSQLquerywillbecopiedautomaticallytothetool.

Thestatuslinewillshowyousomestatusinformation,aswellasthetimethelastactiontookpgAdminIIItocomplete.

Youcanresizethemainwindow,andchangethesizesofthethreemain regions as you prefer. These adjustments will be preservedwhenyouexittheprogram.

pgAdmin isbandwidthfriendly.Thestatusofobjects in thebrowserisonlyrefreshedonrequestorafterchangesmadewiththebuilt-intools.Beawarethat thisdoesnotcoverchangesmadeviamanualSQLorfromotherusersorotherclients.Itisgenerallyadvisabletomanually refresh objects before working on them in suchenvironments.

Page 12: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

GettingstartedAfteryouhaveaddedthedesiredserver(s)tothetreeontheleftsideusingtheAddservermenuortoolbarbutton,eachserverwillshowupunderthetopnode“Servers”.

To open a connection to a server, select the desired server in thetree,anddoubleclickonitoruseConnectfromtheToolsmenu.Theconnection will be established, and the properties of the top levelobjects are retrieved from the database server. If you’ve beenconnected to that database previously, pgAdmin III will restore theprevious selection of database and schema for you. The currentsituation is savedwhenexiting theprogram, so thatpgAdmin III isabletorestorethepreviousenvironment.

Using the menu or toolbar buttons, you can create new objects,deleteobjectsandeditpropertiesofexistingobjectsif theuserthatyou entered when adding the server connection has sufficientprivileges. You may find some options grayed out if displayingproperties. This means, that the database server you’re currentlyusing doesn’t support the feature, or that this property can’t bechangedby design, or that your user privilegeswon’t allow you tochangeit.

YoucansearchforobjectsinthedatabaseusingtheSearchTool

Contents:

Objectsearch

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 13: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdminMain

Window»

Page 14: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Objectsearch

Withthisdialog,youcansearchforalmostanykindofobjects inadatabase.

You can access it by right clicking a database and select “Searchobjects”orbyhittingCTRL-G.

Theminimumpattern lengthare3charactersexcept foroperators.The searchperformed is non-case sensitiveandwill findall objetswhose name contains the pattern. You can only search for objectnames.

Theresultispresentedinthegridwithobjecttype,objectnameandtheobjecttreepath.Youcanclickonaresultrowtoselecttheobjectinthebrowser. If theobject isgrey, thismeansthatyoudon’thaveenabledthoseobjecttypesintheBrowsersettings,soyoucan’tclick

Page 15: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

onit.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdminMain

Window»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 16: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 17: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Connecttoserver

UsethisdialogtoaddanewserverconnectiontothepgAdmintree.

If you’re experiencing connection problems, check the connectionproblems.

ThenameisatexttoidentifytheserverinthepgAdmintree.

The host is the IP address of themachine to contact, or the fullyqualified domain name.OnUnix based systems, the address fieldmay be left blank to use the default PostgreSQL Unix DomainSocket on the local machine, or be set to an alternate pathcontainingaPostgreSQLsocket. Ifapath isentered, itmustbeginwitha“/”.Theportnumbermayalsobespecified.

Page 18: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

The service field is the name of a service configured in thepg_service.conffile.Fordetails,seethepg_servicedocumentation.

ThemaintenanceDBfieldisusedtospecifytheinitialdatabasethatpgAdminconnectsto,andthatwillbeexpectedtohavethepgAgentschema and adminpack objects installed (both optional). OnPostgreSQL8.1andabove, themaintenanceDBisnormallycalled‘postgres’,andonearlierversions‘template1’isoftenused,thoughitis preferrable to create a ‘postgres’ database for this purpose toavoidclutteringthetemplatedatabase.

Ifyouselect“Storepassword”,pgAdminstorespasswordsyouenterin the ~/.pgpass file under Unix or:file:%APPDATA%postgresqlpgpass.conf under Win32 for laterreuse.Fordetails,seepgpassdocumentation. Itwillbeusedforalllibpqbasedtools.Ifyouwantthepasswordremoved,youcanselecttheserver’spropertiesandunchecktheselectionanytime.

The colour field allows you to set a specific colour for this server.This colourwill beused in thebackgroundof the treewhereeachobjectofthisserverisdisplayed.

TheGroupfieldisusedtopushyourserverinaspecificgroup.Youcan have a production group, and a test group. Or LAN specificgroups.It’scompletelyuptoyou.Butithelpswhenyouhavelorsofservertoregister.

Thesecond tabhasall theSSLspecificoptions:whatkindofSSLconnectionyouwant,yourrootcertificatefile,yourserverCRL,yourclientcertificatefile,andfinallyyourclientkeyfile.

The third tab contains some advanced options that are seldomlyused.

The“Connectnow?” fieldmakespgAdminattemptaconnectionassoonasyouhittheOKbutton.

Page 19: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Youcanunckeckthe“Connectnow”checkboxifyoudon’twanttheconnection to the server being established immediately, but onlyregistered for later use. In this case, the connection parameterswon’tbevalidated.

The “Restoreenv?”optiondetermineswhetherornotpgAdminwillattempt to restore thebrowserenvironmentwhenyou reconnect tothis server. If you regularly use different databases on the sameserveryoumightwanttoturnthisoptionoff.

TheRolenamefieldallowsyoutoconnectasarole,andthengetthepermissionsofanotherone(theoneyouspecifiedinthisfield).Theconnectionrolemustbeamemberoftherolename.

TheDB restriction field allows you to enter anSQL restriction thatwill be used against the pg_database table to limit the databasesthat you see. For example, youmight enter: ‘live_db’, ‘test_db’ sothat only live_db and test_db are shown in the pgAdmin browser.Notethatyoucanalsolimittheschemasshowninthedatabasefromthe Database properties dialogue by entering a restriction againstpg_namespace.

The “Service ID” fieldspecifiesparameters tocontrol thedatabaseserviceprocess.Itsmeaningisoperatingsystemdependent.

If pgAdmin is running on a Windows machine, it can control thepostmaster service if you have enough access rights. Enter thename of the service. In case of a remote server, it must beprependedbythemachinename(e.g.PSE1pgsql-8.0).pgAdminwillautomaticallydiscoverservicesrunningonyourlocalmachine.

If pgAdmin is runningonaUnixmachine, it can control processesrunning on the local machine if you have enough access rights.Enterafullpathandneededoptionstoaccessthepg_ctlprogram.When executing service control functions, pgAdmin will appendstatus/start/stopkeywordstothis.Example:

Page 20: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

sudo/usr/local/pgsql/bin/pg_ctl-D/data/pgsql

This dialog can be launched at a later time to correct or addparameters by executing “properties” when the server is selected.Youshouldnotbeconnectedtoitifyouwanttomakechangesonitsproperties.

Contents:

ConnectionerrorscouldnotconnecttoServer:ConnectionrefusedFATAL:nopg_hba.confentry

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 21: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Connectto

server»

Page 22: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ConnectionerrorsWhen connecting to a PostgreSQL server, you might get errormessages that need some more explanations. If you encounterthem,pleasereadthefollowinginformationcarefully,we’resuretheywillhelpyou.

notrunningno-hba

Page 23: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

couldnotconnecttoServer:Connectionrefused

If this message appears, there are two possible reasons for this:eithertheserverisn’trunningatall.Simplystartit.

Theothernon-trivial cause for thismessage is that theserver isn’tconfiguredtoacceptTCP/IPrequestsontheaddressshown.

Forsecurity reasons,aPostgreSQLserver “outof thebox”doesn’tlisten on TCP/IP ports. Instead, it has to be enabled to listen forTCP/IP requests. This can be done by adding tcpip = true to thepostgresql.conf file for Versions 7.3.x and 7.4.x, orlisten_addresses=’*’forVersion8.0.xandabove;thiswillmakethe

Page 24: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

serveracceptconnectionsonanyIPinterface.

For further information, please refer to the PostgreSQLdocumentationaboutruntimeconfiguration.

Page 25: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

FATAL:nopg_hba.confentry

Ifthismessageappears,yourservercanbecontactedcorrectlyoverthe network, but isn’t configured to accept your connection. Yourclientisn’tdetectedasalegaluserforthedatabase.

Youwillhavetoaddanentryintheformhosttemplate1postgres192.168.0.0/24 md5 for IPV4 or host template1 postgres::ffff:192.168.0.0/120md5forIPV6networkstothepg_hba.conffile.

For further information, please refer to the PostgreSQLdocumentationaboutclientauthentication.

Page 26: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Connectto

server»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 27: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 28: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ChangePassword

Tochangeyourpassword,followthefollowingsteps:

1. EnteryourcurrentpasswordintheCurrentPasswordtextbox.2. EnteryourdesiredpasswordintheNewPasswordtextbox.3. Enter your desired password again, this time in the Confirm

Passwordtextbox.4. ClicktheOKbutton.

Page 29: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

GoodpracticeItisgoodpolicytosetapasswordtoprotectyourdata,evenin‘safe’environmentssuchasathome.Intheworkplace,failuretoapplyanappropriate password policy could leave you in breach of DataProtectionlawsinsomecircumstances.

pgAdmindoesnotenforceanypasswordrestrictions,howeverwedorecommend that you consider the following guidelines whenselecting passwords. This is not an exhaustive list and will notguaranteesecurity.

Ensure that passwords are of adequate length. 6 charactersshouldbetheabsoluteminimum.Ensure that passwords are not easily guessable by others, oropen to dictionary attacks. Use a mixture of upper and lowercase letters and numerics, and avoid using words or names.Considerusing the first letter fromeachword inaphrase thatyouwillrememebereasilybutotherswillnotguess.Ensure thatyourpassword ischangeregularly -at leasteveryninetydays.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 30: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 31: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ControlServerIf youentered correct data in theServer property dialogue servicefield,pgAdminwillcheckiftheserviceisrunning,andallowstostartandstoptheservice.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 32: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 33: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Querytool

TheQueryToolenablesyoutoexecutearbitrarySQLcommands.

TheupperpartoftheQueryToolcontainstheSQLEditorwhereyoutypeyourcommands.Youmayreadthequeryfromafile,orwriteitouttoafile.Whenwritingafile,theencodingofthefileisdeterminedby the file suffix: if it is *.sql, a 8 bit local character set is used. If*.usqlisselected,thefilewillbewritteninUTF-8,whichenablesthestorage of virtually all characters used throughout the world,according to the coding rules of the Unicode Consortium. If you

Page 34: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

select*.*,thesettingfromtheread/writeunicodeoptionisused.

Theeditentrywindowalsocontainsautocompletioncodetohelpyouwrite queries. To use autocomplete, simply start typing your queryandthenpressControl+Spacetoseealistofpossibleobjectnamesto insert. For example, type “*SELECT * FROM* ” (without thequotes,butwiththetrailingspace),andthenhitControlandSpacetogether to see a popup menu of autocomplete options. Theautocompletesystem isbasedoncode frompsql, thePostgreSQLcommand line interpreter and will generally be able to offerautocompleteoptionsinthesameplacesthatitcaninpsql.YoucanoptionallyenabletheTabkeytoactivatetheautocompletefeatureaswell-thecanbedoneontheoptionsdialog.

The editor also offers a number of features for helping with codeformatting:

The auto-indent feature will automatically indent text to thesamedepthasthepreviouslinewhenyoupressreturn.BlockindenttextbyselectingtwoormorelinesandpressingtheTabkey.BlockoutdenttextthathasbeenindentedusingthecurrenttabsettingsusingShift+Tab.Comment out SQL by selecting some text and pressing theControl+K.Uncomment SQL by selecting some text starting with acommentandpressingControl+Shift+K.Shift the selected text to upper case by pressingControl+Shift+U.ShifttheselectedtexttolowercasebypressingControl+U.

If you prefer to build your queries graphically, you can use theGraphicalQuerybuildertogeneratetheSQLforyou.

Toexecuteaquery,selectExecutefromtheQuerymenu,pressthe

Page 35: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

execute toolbarbutton,orpress theF5 functionkey.Thecompletecontents of thewindowwill be sent to the database server, whichexecutesit.Youmayalsoexecutejustapartofthetext,byselectingonlythetextthatyouwanttheservertoexecute.

Explain from theQuerymenu, or F7 function key will execute theEXPLAIN command. The database server will analyze the querythat’ssenttoit,andwillreturntheresults.

The result is displayed as text in the Data Output page, andgraphicallyvisualizedontheExplainpage.Thisenablesyoutofindout how the query is parsed, optimized and executed. You can

Page 36: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

modifythedegreeofinspectionbychangingtheExplainoptionsforthisintheQuerymenu.Pleasenotethat“EXPLAINVERBOSE”cannotbedisplayedgraphically.

IncasethequeryyousenttotheserverusingtheExecuteorExplaincommandtakeslongerthanyouexpect,andyouwouldliketoabortthe execution, you can selectCancel from theQuerymenu, presstheCanceltoolbarbuttonoruseAlt-Breakfunctionkeytoaborttheexecution.

YoucanrunpgScriptscriptsbyselectingExecutepgScriptfromtheQuerymenuinsteadofExecute,oryoupresstheExecutepgScripttoolbar button, or you press the F6 function key. The completecontentsoftheeditentrywindowwillbesenttothepgScriptengine,which interprets it. pgScript scripts are composed of regular SQLcommandsbutaddsomeenhancements:

Control-of-flowlanguage(IFandWHILEstructures)Localvariables(SET@VARIABLE=5)Randomdatagenerators(INTEGER(10,20)orREFERENCE(table,column))

Formore information on the pgScript language, please look at thepgScriptscriptinglanguagereference.

If you want to have help about a SQL command you want toexecute,youcanmarkaSQLkeywordandselectSQLHelpfromtheHelpmenu,theSQLHelptoolbarbuttonorsimplypresstheF1key.pgAdmin III will try to locate the appropriate information in thePostgreSQLdocumentationforyou.

Theresultof thedatabaseserverexecutionwillbedisplayedinthelowerpartoftheQueryTool.IfthelastcommandinthechainofSQLcommandsenttotheserverwasascommandreturningaresultset,this will be shown on the Data Output page. All rowsets from

Page 37: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

previouscommandswillbediscarded.

TosavethedataintheDataOutputpagetoafile,youcanusetheExportdialog.

Information about all commands just executed will go to theMessages page. The History page will remember all commandsexecutedandtheresultsfromthis,untilyouuseClearHistoryfromtheQuerymenutoclearthewindow.Ifyouwanttoretainthehistoryforlaterinspection,youcansavethecontentsoftheHistorypagetoafileusingtheSavehistoryoptionfromtheQuerymenu.

Thestatuslinewillshowhowlongthelastquerytooktocomplete.Ifa dataset was returned, not only the elapsed time for serverexecution isdisplayed,butalso the time to retrieve thedataaboutyourcurrentselection.

In the toolbar combobox you can quickly change your databaseconnectionfromonedatabasetoanother,withoutlaunchinganotherinstance of the query tool. Initially, only one database will beavailable, but by selecting <new connection> from the combobox,youcanaddanotherconnectiontoit.

In theoptionsdialog, you can specify adefault limit for the rowsetsize to retrieve.Bydefault, thisvaluewill be100. If thenumberofrowstoretrievefromtheserverexceedsthisvalue,amessageboxwillappearaskingwhat todo toprevent retrievalofanunexpected

Page 38: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

highamountofdata.Youmaydecide toretrieve just the first rows,asconfiguredwith themax rowssetting,or retrieving thecompleterowset regardless of the setting, or abort the query, effectivelyretrievingzerorows.

Ifyouhavequeriesthatyouexecuteoften,youcanaddthesetothefavouritesmenu,andhavethemautomaticallyputinthebufferwhenyou select them from the menu. The Manage Favourites menuoptionmay be used to organise your favourites. Alternatively, youcanstorethemasQueryToolMacros.

TheQueryToolalso includesapowerfulFindandReplace tool. Inadditiontoofferingthenormaloptionsfoundinmosttools,aRegularExpression search mode is included which allows you to performextremely powerful search (and replace) operations. Unless yourcopy of pgAdmin was built against a non-standard build ofwxWidgets,abuiltinversionofHenrySpencer’sregularexpressionlibraryisusedbasedonthe1003.2specandsome(notquiteall)ofthePerl5extensions.

Formoredetailsoftheregularexpressionsyntaxoffered,pleaseseethewxWidgetsdocumentation.

Contents:

GraphicalQuerybuilderpgAdminDataExportQueryToolMacrospgScriptScriptingLanguageReference

OverviewExamplesSQLCommandsVariablesControl-of-flowstructuresAdditionalfunctionsandprocedures

Page 39: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Randomdatagenerators

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 40: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Querytool»

Page 41: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

GraphicalQuerybuilder

TheGraphicalQueryBuilder(GQB)ispartoftheQueryToolwhichallowsyoutobuildsimpleSQLqueriesvisually.

TherearethreemainpartsoftheGQB.Therelationbrowserontheleft hand side allows you to select catalogs, classes and views toinclude in your queries. Along the bottom are a set of tabs whichallowyoutospecifyselectioncriteria,outputformatandsorting.Thethird section is the canvas on which you draw the relationshipsbetweentherelationsinyourtables.Youcanadjusttherelativesize

Page 42: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ofeachsectionbydraggingthejoin(orsash)betweenthepanes.

Toaddrelationstothequery,eitherdoubleclickthemintherelationbrowser, or drag them from thebrowser onto the canvas.You canarrangerelationsonthecanvasbyselectingtherelationnamewiththemouseandmovingtherelationtothedesiredposition.

Tocreate joinsbetween relations,dragacolumn fromone relationontoanother.Alinewillbedrawnbetweenthemtoindicatethejoin.Right-clickingthejoinwillpresentapopupmenufromwhereyoucanselectthejoinoperatorordeleteit.

Toselectthecolumnsthatwillappearinthequeryresults,checkthedesired columns within the relation on the canvas. Each columnselectedwillbeaddedto the listontheColumnstabonwhichyoucanadjusttheordering,andspecifycolumnaliases.

Tospecifyselectioncriteria,addrowstothegridontheCriteriatab.The restricted value can be set to a column name, or a constantvalue.TheOperatorcolumnallowsyoutoselectasimpleoperatortobeused tocompare the restrictedvaluewith thevaluespecified intheValue column.TheConnector specifies how the criteriawill bejoinedtothenext(ifany).

The query resultsmay be ordered on theOrdering tab.Select thecolumns required on the left, and use the buttons in themiddle toadd them to the ordering list on the right. You can also removecolumns in the sameway.For each columnadded to theorderinglist, you can specify the sorting direction. You can also adjust thepriorityofeachorderingcolumnbyselectingit,andmovingitupordownthelistusingthebuttonsontheright.

When you have designed your query, you can use the Execute,ExecutetoFile,orExplainoptionsonthetoobar(andQuerymenu)togenerateandexecutethequery.

Page 43: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Querytool»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 44: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 45: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminDataExport

Dataiswrittentoafile,usingtheselectedoptions.

The row separator option selects the character used to separaterowsofdata.OnUnixsystems,usuallya linefeedcharacter(LF) isused, on Windows system a carriage return/linefeed (CR/LF)combination.

Theseparatingcharacterbetweencolumnscanbeselectedbetweencolon,semicolonandaverticalbar.

The individualcolumnscanbeenclosed inquotes.Quotingcanbeapplied to string columns only (i.e. numeric columns will not bequoted)orallcolumnsregardlessofdata type.Thecharacterusedforquotingcanbeasinglequoteoradoublequote.

Ifthe“Columnnames”optionisselected,thefirstrowofthefilewillcontainthecolumnnames.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 46: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Querytool»

Page 47: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

QueryToolMacros

QueryToolMacrosenableyoutoexecutepre-definedSQLquerieswith single key press. Pre-defined queries can contain theplaceholder$SELECTION$.Uponmacroexecution,theplaceholderwillbe replacedwith thecurrentlyselected text in theSQLpaneoftheQueryTool.

To create a macro, select the Manage Macros option from theMacrosmenu on theQuery Tool. Select the key youwish to use,enterthenameofthemacro,andthequery,optionallyincludingtheselection placeholder, and then click the Save button to store themacro.

Toclearamacro,selectthemacroontheManageMacrosdialogue,andthenclicktheClearbutton.

Toexecuteamacro,simplypress theappropriateshortcutkeys,orselectitfromtheMacrosmenu.

Page 48: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Querytool»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 49: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Querytool»

Page 50: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgScriptScriptingLanguageReference

Page 51: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

OverviewpgScriptiscomposedofpgScriptcommands:

pgScriptcommand

:RegularPostgreSQLSQLCommand(SELECTINSERTCREATE...)

|Variabledeclarationorassignment(DECLARESET)

|Control-of-flowstructure(IFWHILE)

|Procedure(ASSERTPRINTLOGRMLINE)

Command names (SELECT, IF,SET, ...) are case-insensitive andmustbeendedwithasemi-column;.Identifiersarecase-sensitive.

Page 52: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Examples

Batchtablecreations

DECLARE@I,@T;--Variablenamesbeginwitha@

SET@I=0;--@Iisaninteger

WHILE@I&lt;20

BEGIN

SET@T='table'+CAST(@IASSTRING);--Casts@I

CREATETABLE@T(idintegerprimarykey,datatext);

SET@I=@I+1;

END

Insertrandomdata

DECLARE@I,@J,@T,@G;

SET@I=0;

SET@G1=INTEGER(10,29,1);/*Randomintegergenerator

Uniquenumbersbetween10and29*/

SET@G2=STRING(10,20,3);/*Randomstringgenerator

3wordsbetween10and20characters*/

WHILE@I&lt;20

BEGIN

SET@T='table'+CAST(@IASSTRING);

SET@J=0;

WHILE@J&lt;20

BEGIN

INSERTINTO@TVALUES(@G1,'@G2');

SET@J=@J+1;

END

SET@I=@I+1;

END

Batchtabledeletions

DECLARE@I,@T;--Declaringisoptional

Page 53: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SET@I=0;

WHILE1--Alwaystrue

BEGIN

IF@I&gt;=20

BREAK;--Exittheloopif@I&gt;20

SET@T='table'+CAST(@IASSTRING);

DROPTABLE@T;

SET@I=@I+1;

END

Printinformationonscreen

SET@PROGR@M#TITLE='pgScript';

PRINT'';

PRINT@PROGR@M#TITLE+'features:';

PRINT'';

PRINT'*RegularPostgreSQLcommands';

PRINT'*Control-of-flowlanguage';

PRINT'*Localvariables';

PRINT'*Randomdatagenerators';</pre>

Page 54: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SQLCommandsYoucanrunANYPostgreSQLqueryfromapgScriptEXCEPTthoseones:

BEGIN;

END;

This is becauseBEGIN and END are used for delimiting blocks.Insteaduse:

BEGINTRANSACTION;

ENDTRANSACTION;

For a list of PostgreSQL commands:http://www.postgresql.org/docs/8.3/interactive/sql-commands.html

Page 55: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

VariablesTherearetwomaintypesofvariables:simplevariablesandrecords(resultsetscomposedoflinesandcolumns).

Variable names begin with a @ and can be composed of letters,digits,_,#,@.

Variabletypeisguessedautomaticallyaccordingtothekindofvalueit contains. This can be one of: number (real or integer), string,record.

Simplevariables

Simplevariabledeclaration

Declaringsimplevariableisoptional:

DECLARE@A,@B;

DECLARE@VAR1;

Simplevariableaffectation

ThisisdonewiththeSETcommand.Thevariabletypedependsonthevalueassignedtothisvariable:

SET@A=1000,@B=2000;--@Aand@Bare<strong>integernumbers**

SET@C=10e1,@D=1.5;--@Cand@Dare<strong>realnumbers**

SET@E='ab',@F='a''b';--@Eand@Fare<strong>strings**

SET@G="ab",@H="a\"b";--@Gand@Hare<strong>strings**

Anuninitializedvariabledefaultstoanemptystring.It ispossibletooverridevariablesasmanytimesaswanted:

Page 56: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

PRINT@A;--Printsanemptystring

SET@A=1000;--@Aisinitializedaninteger

PRINT@A;--Prints1000

SET@A='ab';--@Abecomesastring

PRINT@A;--Printsab

Datagenerators

Datageneratorsallowsuserstogeneraterandomvalues.Therearevarious types of generators, each one producing different type ofdata. A variable initialized with a data generator behaves like aregularsimplevariableexceptthatithasadifferentvalueeachtimeitisused:

SET@A=INTEGER(100,200);

PRINT@A;--Printsanintegerbetween100and200

PRINT@A;--Printsanotherintegerbetween100and200

A variable can contain a generator but its type is one of: number(real or integer), string. For a list of available generators and theirassociatedtype,seegenerators.

Records

Recorddeclaration

Declaring a record is required. A name for each columnmust bespecifiedeveniftheywillnotbeusedanymoreafterwards:

DECLARE@R1{@A,@B},@R2{@A,@C};--Tworecordswithtwocolumns

DECLARE@R3{@A,@B,@C,@D};--Onerecordwithfourcolumns

Thenumberoflinesisdynamic:seethenextsection.

Recordaffectation

Page 57: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

To access a specific location in a record, one must use the linenumber(startsat0)andcanuseeitherthecolumnname(betweenquotes) or the column number (starts at 0). This specific locationbehaveslikeasimplevariable.Notethatarecordcannotcontainarecord:

SET@R1[0]['@A']=1;--Firstline&amp;firstcolumn

SET@R1[0][0]=1;--Samelocation

SET@R1[4]['@B']=1;--Fifthline&amp;secondcolumn

SET@R1[0][1]=1;--Samelocation

In theaboveexample, threeempty linesareautomatically insertedbetween the first and the fifth.Using an invalid column number ornameresultsinanexception.

Specificlocationcanbeusedasrightvaluesaswell.Aspecificlinecanalsobeusedasrightvalue:

SET@R1[0][0]=@R3[0][1],@A=@R2[0][0];--Behaveslikesimplevariables

SET@A=@R1[1];--@Abecomesarecordwhichisthefirstlineof@R1

RememberthatSET@R1[0][0]=@R2isimpossiblebecausearecordcannotcontainarecord.

Itispossibletoassignarecordtoavariable,inthiscasethevariabledoesnotneedtobedeclared:

SET@A=@R3;--@Abecomesarecordbecauseitisassignedarecord

SQLqueries

AnySQLqueryexecuted returnsa record. If thequery isa SELECTquery then it returns theresultsof thequery. If it issomethingelsethenitreturnsaone-linerecord(true)ifthisisasuccessotherwiseazero-linerecord(false):

Page 58: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SET@A=SELECT*FROMtable;--@Aisarecordwiththeresultsofthequery

SET@B=INSERTINTOtable...;--@Bisaone-linerecordifthequerysucceeds

Recordfunctions

Seefunction2.

Cast

Itispossibletoconvertavariablefromonetypetoanotherwiththecastfunction:

SET@A=CAST(@BASSTRING);

SET@A=CAST(@BASREAL);

SET@A=CAST(@BASINTEGER);

SET@A=CAST(@BASRECORD);

When a record is converted to a string, it is converted to its flatrepresentation. When converted to a number, the record is firstconvertedtoastringandthentoanumber(seestringconversionformoredetails).

Whenanumber isconvertedtoastring, it isconvertedto itsstringrepresentation.Whenconvertedtoarecord,itisconvertedtoaone-line-one-columnrecordwhosevalueisthenumber.

When a string is converted to a number, if the string represents anumber then this number is returned else an exception is thrown.Whenconverted toa record,either theprogramcan finda recordpatterninthestringoritconvertsittoaone-line-one-columnrecordwhosevalueisthestring.Arecordpatternis:

SET@B='(1,"abc","ab\\"")(1,"abc","ab\\"")';--@Bisastring

SET@B=CAST(@BASRECORD);@Bbecomesatwo-line-three-columnrecord

Page 59: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Remember a string is surrounded by simple quotes. Stringscomposingarecordmustbesurroundedbydoublequoteswhichareescapedwith\\(wedoubletheslashbecauseitisalreadyaspecialcharacterfortheenclosingsimplequotes).

Operations

Operations can only be performed between operands of the sametype.Castvaluesinordertoconformtothiscriterion.

Comparisonsresultinanumberwhichis0or1.

Strings

Comparisons:=<>><<=>=ANDOR

Concatenation:+

SET@B=@A+'abcdef';--@Amustbeastringand@Bwillbeastring

Booleanvalue:non-emptystringistrue,emptystringisfalse

Inversebooleanvalue:NOT

Case-insensitivecomparison:~=

Numbers

Comparisons:=<>><<=>=ANDOR

Arithmetic:+-*/%

SET@A=CAST('10'ASINTEGER)+5;--'10'stringisconvertedtoanumber

Page 60: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Booleanvalue:0isfalse,anythingelseistrue

Inversebooleanvalue:NOT(notethatNOTNOT10=1)

An arithmetic operation involving at least one real number gives arealnumberasaresult:

SET@A=10/4.;--4.isarealsorealdivision:@A=2.5

SET@A=10/4;--4isanintegersointegerdivision:@A=2

Records

Comparisons:=<>><<=>=ANDOR

Booleanvalue:zero-linerecordisfalse,anythingelseistrue

Inversebooleanvalue:NOT

Comparisonsforrecordsareaboutinclusionandexclusion.Orderoflines does notmatter. <=means that each row in the left operandhasamatchintherightoperand.>=meanstheopposite. =meansthat<=and>=arebothtrueatthesametime...

Comparisons are performed on strings: even if a record containsnumberslike10and1e1wewillhave'10'<>'1e1'.

Page 61: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Control-of-flowstructures

Conditionalstructure

IFcondition

BEGIN

pgScriptcommands

END

ELSE

BEGIN

pgScriptcommands

END

pgScript commands are optional. BEGIN and END keywords areoptionalifthereisonlyonepgScriptcommand.

Loopstructure

WHILEcondition

BEGIN

pgScriptcommands

END

pgScript commands are optional. BEGIN and END keywords areoptionalifthereisonlyonepgScriptcommand.

BREAKends theenclosingWHILE loop,whileCONTINUE causesthe next iteration of the loop to execute. RETURN behaves likeBREAK:

WHILEcondition1

BEGIN

IFcondition2

BEGIN

BREAK;

END

END

Page 62: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Conditions

Conditionsare in fact resultsof operations.Forexample the stringcomparison'ab'='ac'will result inanumberwhich is false (theequalityisnottrue):

IF'ab'~='AB'--Case-insensitivecomparisonwhichresultin1(true)whichistrue

BEGIN

--Thishappens

END

IF0--false

BEGIN

--Thisdoes**not**happen

END

ELSE

BEGIN

--Thishappens

END

WHILE1

BEGIN

--Infiniteloop:useBREAKforexiting

END

It is possible to the result of a SQL SELECT query directly as acondition.Thequeryneedstobesurroundedbyparenthesis:

IF(SELECT1FROMtable)

BEGIN

--Thismeansthattableexistsotherwisetheconditionwouldbefalse

END

Page 63: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Additionalfunctionsandprocedures

Procedures

Proceduresdonotreturnaresult.Theymustbeusedaloneonalineandcannotbeassignedtoavariable.

Print

Printsanexpressiononthescreen:

PRINT'Thevalueof@Ais'+CAST(@AASSTRING);

Assert

Throwsanexceptioniftheexpressionevaluatedisfalse:

ASSERT5&gt;3AND'a'='a';

Removeline

Removesthespecifiedlineofarecord:

RMLINE(@R[1]);--Removes@Rsecondline

Functions

Functionsdoreturnaresult.Theirreturnvaluecanbeassignedtoavariable,liketheCASToperation.

Trim

Removesextraspacessurroundingastring:

Page 64: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SET@A=TRIM('a');--@A='a'</pre>

Lines

Givesthenumberoflinesinarecord:

IFLINES(@R)&gt;0

BEGIN

--Process

END

Columns

Givesthenumberofcolumnsinarecord:

IFCOLUMNS(@R)&gt;0

BEGIN

--Process

END

Page 65: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Randomdatagenerators

Overviewofthegenerators

One can assign a variable (SET) with a random data generators.Thismeanseachtimethevariablewillbeuseditwillhaveadifferentvalue.

Howeverthevariableisstillusedasusual:

SET@G=STRING(10,20,2);

SET@A=@G;--@Awillholdarandomstring

SET@B=@G;--@Bwillholdanotherrandomstring

PRINT@G,--Thiswillprintanotherthirdrandomstring

Sequenceandseeding

Commonparametersfordatageneratorsaresequenceandseed.

sequence means that a sequence of values is generated in arandomorder, inotherwordseachvalueappearsonlyoncebeforethesequencestartsagain: this isuseful for columnswitha UNIQUEconstraint.Forexample,thisgenerator:

SET@G=INTEGER(10,15,1);--1meansgenerateasequence

Itcangeneratesuchvalues:

1412101311151412101311

Where each number appears once before the sequence startsrepeating.

sequenceparametermustbeaninteger:ifit is0thennosequence

Page 66: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

isgenerated(default)andifsomethingotherthan0thengenerateasequence.

seed is an integer value for initializingagenerator: twogeneratorswiththesameparametersandthesameseedwillgenerateexactlythesamevalues.

seedmustbean integer: it isuseddirectly to initialize the randomdatagenerator.

Datagenerators

Optionalparametersareputintobrackets:

Generator

:INTEGER(min,max,[sequence],[seed]);

|REAL(min,max,precision,[sequence],[seed]);

|DATE(min,max,[sequence],[seed]);

|TIME(min,max,[sequence],[seed]);

|DATETIME(min,max,[sequence],[seed]);

|STRING(min,max,[nb],[seed]);

|REGEX(regex,[seed]);

|FILE(path,[sequence],[seed],[encoding]);

|REFERENCE(table,column,[sequence],[seed]);

Integernumbers

INTEGER(min,max,[sequence],[seed]);

INTEGER(-10,10,1,123456);

minisaninteger,maxisaninteger,sequenceisanintegerandseedisaninteger.

Realnumbers

REAL(min,max,precision,[sequence],[seed]);

REAL(1.5,1.8,2,1);

Page 67: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

min is a number, max is a number, precision is an integer thatindicatesthenumberofdecimals(shouldbelessthan30),sequenceisanintegerandseedisaninteger.

Dates

DATE(min,max,[sequence],[seed]);

DATE('2008-05-01','2008-05-05',0);

min is a string representing a date, max is a string representing adate,sequenceisanintegerandseedisaninteger.

Times

TIME(min,max,[sequence],[seed]);

TIME('00:30:00','00:30:15',0);

min is a string representing a time, max is a string representing atime,sequenceisanintegerandseedisaninteger.

Timestamps(date/times)

DATETIME(min,max,[sequence],[seed]);

DATETIME('2008-05-0114:00:00','2008-05-0515:00:00',1);

minisastringrepresentingatimestamp,maxisastringrepresentingatimestamp,sequenceisanintegerandseedisaninteger.

Strings

STRING(min,max,[nb],[seed]);

STRING(10,20,5);

min isanintegerrepresentingtheminimumlengthofaword,maxisan integer representing the maximum length of a word, nb is an

Page 68: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

integerrepresentingthenumberofwords(default:1)andseedisaninteger.

Intheaboveexamplewegenerate5words(separatedwithaspace)whosesizeisbetween10and20characters.

Stringsfromregularexpressions

REGEX(regex,[seed]);

REGEX('[a-z]{1,3}@[0-9]{3}');

regex is a string representing a simplified regular expressions andseedisaninteger.

Simplifiedregularexpressionsarecomposedof:

Setsofpossiblecharacterslike[a-z_.]forcharactersbetweenaandz+_and.Singlecharacters

It is possible to specify the minimum and maximum length of theprecedingsetorsinglecharacter:

{min,max}like{1,3}whichstandsforlengthbetween1and3{min}like{3}whichstandsforlengthof3Default(whennothingisspecified)islengthof1

Note:becarefulwithspacesbecause'a{3}'meansoneafollowedbythreespacesbecausethe3 isabout the lastcharacterorsetofcharacterswhichisaspaceinthisexample.

Ifyouneedtouse[]\{or},theymustbeescapedbecausetheyare special characters. Remember to usedouble backslash: '\\[{3}'forthree[.

Page 69: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Stringsfromdictionaryfiles

FILE(path,[sequence],[seed],[encoding]);

FILE('file.txt',0,54321,'utf-8');

path is a string representing the path to a text file, sequence is aninteger,seed isanintegerandencoding isastringrepresentingthefilecharacterset(defaultissystemencoding).

Thisgeneratesarandomintegerbetween1andthenumberoflinesinthefileandthenreturnsthatline.Ifthefiledoesnotexistthenanexceptionisthrown.

encodingsupports themostknownencoding likeutf-8,utf-16le,utf-16be,iso-8859-1,...

Referencetoanotherfield

REFERENCE(table,column,[sequence],[seed]);

REFERENCE('tab','col',1);

tableisastringrepresentingatable,columnisastringrepresentingacolumnofthetable,sequenceisanintegerandseedisaninteger.

Thisisusefulforgeneratingdatatoputintoforeign-key-constrainedcolumns.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»Querytool»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 70: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 71: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminDebugger

The debugger may be used to debug pl/pgsql functions inPostgreSQL,aswellasEDB-SPLfunctions,storedproceduresandpackagesinEnterpriseDB.

Note: The debugger may only be used by roles with ‘superuser’privileges.

In order to use the debugger, a plugin is required on your server.This is included by default with EnterpriseDB, and is available fordownloadonpgFoundry. It is installedasacontribmodulewiththeWindowsdistributionofPostgreSQL8.3andabove.

Thedebuggermaybeusedforbothin-contextanddirectdebugging.

Page 72: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Todebuganobject in-context, rightclick it in thepgAdminbrowsertreeview, and select the “Global breakpoint” option. The debuggerwillthenwaitforthenextsessiontoexecutetheobject,andbreakonthe first line of executable code. To directly debug an object, rightclickitandselectthe“Debug”option.Thedebuggerwillpromptyoufor any parameter values thatmay be required, invoke the object,andbreakonthefirstlineofexecutablecode.

Whenenteringparametervalues,typethevalueintotheappropriatecellonthegrid,or, leavethecellemptytorepresentNULL,enter ‘’(twosinglequotes)torepresentanemptystring,ortoenteraliteralstringconsistingof just twosinglequotes,enter ‘’.PostgreSQL8.4and above supports variadic function parameters. These may beenteredasacomma-delimited listofvalues,quotedand/orcastasrequired.

Once the debugger session has started, you can step through thecodeusingthemenuoptions,keyboardshortcutsortoolbarbuttons.Breakpointsmaybesetor clearedbyclicking in themarginof thesourcewindow,orbyclickingonthedesiredcodelineandusingthe“Toggle breakpoint” button or menu option. If you step into otherfunctions,theStackpanemaybeusedtonavigatetodifferentstackframes-simplyselecttheframeyouwishtoview.

Whenthedebuggerhasreachedtheendoftheexecutablecode, ifrunning in-context it will wait for the next call to the function,otherwise it will prompt for parameter values again and restartexecution.Youmayexitthedebuggeratanytime.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 73: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 74: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

EditData

TheEditGridtoolallowsyoutoviewthedatathat’sstoredinatableorview,andtoeditthecontentiftechnicallypossible.

Theheaderofthegridwillshowthenameofeachcolumn,togetherwith the data type. A column that’s part of the primary key willadditionallybemarkedwith[PK].

Important: Inorder toedit thedata,eachrow in the tablemustbeuniquely identifiable.Thiscanbedoneusing theOID,oraprimarykey.Ifnoneofthemexist,thetableisreadonly.Notethatviewscan’tbeeditedandarereadonlybydesign;updatableviews(usingrules)arenotsupportedatthistime.

Page 75: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Tochangethevalueofafield,youselectthatfieldandenterthenewtext.TheStore toolbarbuttonallows thedata tobewrittenback tothe server. The row will be written automatically, if you select adifferentrow.

Toenteranewrowintothetable,youenterthedataintothelastrowthat has a row number marked with an asterisk. As soon as youstore the data, the row will get a row number, and a fresh emptyasterisklineiscreated.

IfanSQLNULL is tobewritten to the table, simply leave the fieldempty.Ifyoustoreanewrow,thiswilllettheserverfillinthedefaultvalue for thatcolumn. Ifyoustoreachange toanexistingrow, thevalueNULLwillexplicitlybewritten.

Toenteranewlineintoafield,pressCtrl-Enter.

If you want pgAdmin III to write an empty string to the table, youenterthespecialstring‘’(twosinglequotes)inthefield.Ifyouwanttowriteastringcontainingsolelytwosinglequotestothetable,youneedtoescapethesequotes,bytyping‘’

Todeletearow,presstheDeletetoolbarbutton.

TheRefreshtoolbarbuttonallowstorereadthecontentsofthetable,refreshingthedisplay.

Youcanselectoneormorerows,andcopythemwithCtrl-CortheCopytoolbarbuttontotheclipboard.

TheSort/FiltertoolbarbuttonwillopentheViewDataOptionsdialog.

Thecontextmenucanalsobeused toquick-sortorquick-filter thedataset.Whenacellinthegridisright-clicked,thefollowingoptionsallowtheusertoselectivelyviewthedata:

Page 76: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

FilterbySelection:Whenselected, refreshes thedata set anddisplays only those rows whose column value matches thevalueinthecellcurrentlyselected.Exclude by Selection: When selected, refreshes the data setand excludes those rows whose column value matches thevalueinthecellcurrentlyselected.RemoveFilter:Whenselected,removesallselection/exclusionfilterconditions.Sort Ascending: When selected, refreshes the data set anddisplays the currently selected rows in the ascending order ofthe selected column values. If a sorting preference is alreadypresentforthisdataset,thissortingpreferenceisappendedtothecurrentsortorder.Sort Descending: When selected, refreshes the data set anddisplays thecurrentlyselectedrows in thedescendingorderofthe selected column values. If a sorting preference is alreadypresentforthisdataset,thissortingpreferenceisappendedtothecurrentsortorder.Remove Sorting: When selected, removes all sortingpreferencesforthisdataset.

Note: Ifacolumn isalreadyselected forsorting, it’sposition in thesortlistwillremainthesame,onlythedirectionwillbechanged.

Contents:

ViewDataOptions

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 77: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»EditData»

Page 78: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ViewDataOptionsWhen“ApplyFilterandViewData”isselectedfromthemainmenu,or the “Sort/Filter” toolbarbutton ispressed in thedataviewer, thisdialogueappears.Itallowschangingthesortorderofthedata,andapplyingafiltertonarrowthedisplayeddata.

You can select one ormore columns and the sort direction whichshouldbeusedtoretrievethedatafromthedatabase.

Page 79: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

YoucanenteranarbitraryWHEREclause, to restrict the resultsetwhichisretrievedfromthedatabase.Youcanclick“Validate”tohavepgAdminIIItestwhethertheWHEREclauseisvalid.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»EditData»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 80: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 81: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Maintainadatabaseobject

Thistoolallowstomaintainthedatabaseintotal,oronlyaselectedtable,oraselectedindex.

Maintenancecomesinthreeflavors.

Page 82: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

VACUUMVACUUMwillscanthedatabaseortableforrows,thatarenotinuseanymore. Ifa row isupdatedordeleted, thepreviouscontent isn’treplaced,butrathermarkedinvalid.Thenewdataisinsertedfreshlyinto the database. You need to perform a garbage collectionregularly, to insure that your database doesn’t contain too muchunused data, wasting disk space and ultimatively degradingperformance.

PleasepresstheHelpbuttontoseethePostgreSQLhelpabouttheVACUUMcommandtolearnmoreabouttheoptions.

The output of the database server is displayed in the messagespageastheyarrive.IfVerboseisselected,theserverwillsendverydetailedinfoaboutwhatitdid.

Whilethistoolisveryhandyforad-hocmaintenancepurposes,youareencouragedtoinstallanautomaticjob,thatperformsaVACUUMjobregularlytokeepyourdatabaseinaneatstate.

Page 83: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ANALYZEANALYZEinvestigatesstatisticalvaluesabouttheselecteddatabaseortable.Thisenablesthequeryoptimizertoselectthefastestqueryplan,togiveoptimalperformance.Everytimeyourdataischangingradically, you should perform this task. It can be included in aVACUUMrun,usingtheappropriateoption.

Page 84: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

REINDEXREINDEX rebuilds the indexes in case these have degeneratedcaused by unusual data patterns inserted. This can happen forexample if you insertmany rowswith increasing indexvalues,anddeletelowindexvalues.

The RECREATE option doesn’t call the REINDEX SQL commandinternally, instead it drops the existing table and recreates itaccording to thecurrent indexdefinition.Thisdoesn’t lock the tableexclusively,asREINDEXdoes,butwilllockwriteaccessonly.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 85: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 86: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Backup

Page 87: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger
Page 88: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ThebackupdialoguepresentsasomewhatsimplifiedinterfacetothePostgreSQLpg_dumptool.Youcanbackupasingletable,aschemaoracompletedatabase,dependenton theobject youselectwhenstartingthebackuptool.

pg_dump does not support all options for all backup file formats.Particularly, to backup blobs the PLAIN format can not be used.Also,aPLAIN file cannotbe interpreted,andcannotbe restoredusingpgAdmin.ThePLAINformatwillcreateanSQLscriptthatcanbe executed using the psql tool. For standard backup and restorepurposes,theCOMPRESSandTARoptionsarerecommended.

In order to use backup, the pg_dump tool must be accessible bypgAdmin.Thiscanbeaccomplishedbyhavingitlocatableusingthepath, or by copying it into the samedirectorywhere thepgadmin3executableresides.

Page 89: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 90: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 91: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Restore

Page 92: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

TherestoredialoguepresentsasomewhatsimplifiedinterfacetothePostgreSQLpg_restoretool.

Page 93: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Afteryouselectedavalidbackupfile,pgAdminwillreadthecontentsofthefilewhenyoupresstheViewbutton.Thismaytakesometime,dependendonthesizeofthefile.YoucanwatchtheprogressontheMessages tab. After the examination has completed, pgAdminwilldisplaythecontentsontheContentstab.

Intentionally, the toolwillnotcreate thedatabasetoberestored. Inorder torestoreadatabase, firstcreate itusingpgAdmin,andthenstarttherestoretoolwiththatfreshdatabaseselected.Thedatawillberestoredtothatdatabase.

Youcanrestoreasingleobject,wheninrestoredatabasemode(thisisdisplayedinthetitlebar,asinthisexample).Afterexaminingthebackupfile,youcanselectthedesiredtablefromtheContentstab,andchecktheSingleObjectbox.Onlythattablewillberestored.

Youcanselectatableasrestoredestination.pgAdminwillrestoreitsdataifitispresentinthebackupfile.

In order to usebackup, thepg_restore toolmust beaccessible bypgAdmin.Thiscanbeaccomplishedbyhavingitlocatableusingthepath, or by copying it into the samedirectorywhere thepgadmin3executableresides.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 94: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 95: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

GrantWizard

TheGrantWizardallowsassignmentofasetofprivilegestogroupsand users to multiple objects (tables, sequences, views andfunctions)inaconvenientway.

TheSelectiontabwillshowallapplicableobjectsunderthecurrentlyselectedobject.Checkallobjectsyouliketograntprivilegeson.

Thesecuritytabdefinestheprivilegesandgroups/usersthatshouldbegranted.Assigningnoprivileges toagrouporuserwill result inrevokingallrightsforthem.

TheSQLtabshowsthesqlcommandsthataregeneratedfromthe

Page 96: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

selectedgranttargets.

WhenclickingOK,thesqlcommandswillbeexecuted;anyresultwillbedisplayedintheMessagestab.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 97: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 98: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ReportToolpgAdmin includes a simple reporting engine which allows you toquickly generate reports from the queries you write in theQueryTool,orfromobjectsorcollectionsofobjectsinthemainapplicationWindow- forexample,youcancreatea reportof thepropertiesofany object, or a list of functions in a schema. To create a report,selectanodeinthebrowsertreeview,andselectthereporttocreatefrom the contextmenu, or from theReports submenuof theToolsmenu.TocreateareportintheQueryTool,selecttheQuickReportoptionfromtheFilemenu.

Eachreportcontainsatitleandoptionalnotesthatcanbemodified

Page 99: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

beforethereportisproduced.Inaddition,youmayselectwhetherornottoincludeanySQLthatmayberelevanttothereportyouhaveselected.

Reports are generated internally in XML, however pgAdmin canapplyanXMLstylesheet to the reportatprocessing time to formattheoutputasrequired.Adefaultstylesheetisbuilt-inwhichproducesHTMLoutput.WiththeHTMLoutputoptionselected,youcanopttoembedthedefaultCSSstylesheet(whichwillrenderthereportinthesame colors as the pgAdmin website), to embed an externalstylesheet into the report, or to link to an external stylesheet. Thefollowingclass/objectID’sareused:

#ReportHeader:Thisdivcontainsthereportheader.#ReportNotes:Thisdivcontainstheoptionreportnotes.#ReportDetails:Thisdivcontainsthemainbodyofthereport.#ReportFooter:Thisdivcontainsthereportfooter..ReportSQL: This class is used by the <PRE></PRE> blockscontainingSQL..ReportDetailsOddDataRow: This class is applied to the oddnumberedrowsoftables..ReportDetailsEvenDataRow:Thisclassisappliedtotheevennumberedrowsoftables..ReportTableHeaderCell:Thisclass isapplied to tableheadercells..ReportTableValueCell:Thisclassisappliedtotabledatacells..ReportTableInfo:Thisclassisappliedtotablefootnotes.

Page 100: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

WhengeneratingreportsinXMLformat,youcanopttooutputplainXML, XML linked to an external XSL stylesheet, or to process theXMLusinganexternalstylesheetandsavetheresultingoutput.Thisallowscompleteflexibilitytoformatreportsinanyway.

The defaultXSL stylesheet used to render XHTML output can beused as a starting point for your own, and sampleXMLdata mayalsobereviewedifrequired.

Contents:

DefaultXSLStylesheetSampleXMLData

Page 101: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 102: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»ReportTool»

Page 103: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

DefaultXSLStylesheetForreference,andasastartingpoint foryourownstylesheets, thebuiltinstylesheetthatpgadminusestorenderXHTMLreportoutputfromXMLreportdataisincludedbelow.ThisstylesheetincludesthedefaultHTMLstylesheetthatwillbeembeddedintoareporttogiveitthepgadminlookandfeel.

<?xmlversion="1.0"?>

<xsl:stylesheetversion="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:outputmethod="xml"doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"doctype-public="-//W3C//DTDXHTML1.0Transitional//EN"indent="yes"encoding="utf-8"/>

<xsl:templatematch="/report">

<html>

<head>

<xsl:iftest="header/title!=''">

<title><xsl:value-ofselect="header/title"/></title>

</xsl:if>

<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>

<styletype="text/css">

body{font-family:verdana,helvetica,sans-serif;margin:0px;padding:0;}

h1{font-weight:bold;font-size:150%;border-bottom-style:solid;border-bottom-width:2px;margin-top:0px;padding-bottom:0.5ex;color:#EBA525;}

h2{font-size:130%;padding-bottom:0.5ex;color:#47678E;border-bottom-style:solid;border-bottom-width:2px;}

h3{font-size:110%;padding-bottom:0.5ex;color:#000000;}

th{text-align:left;background-color:#47678E;color:#EBA525;}

#ReportHeader{padding:10px;background-color:#47678E;color:#EEEEEE;border-bottom-style:solid;border-bottom-width:2px;border-color:#EBA525;}

#ReportHeaderth{width:25%;white-space:nowrap;vertical-align:top;}

#ReportHeadertd{vertical-align:top;color:#EEEEEE;}

#ReportNotes{padding:10px;background-color:#EEEEEE;font-size:80%;border-bottom-style:solid;border-bottom-width:2px;border-color:#EBA525;}

.ReportSQL{margin-bottom:10px;padding:10px;display:block;background-color:#eeeeee;font-family:monospace;}

#ReportDetails{margin-left:10px;margin-right:10px;margin-bottom:10px;}

#ReportDetailstd,th{font-size:80%;margin-left:2px;margin-right:2px;}

#ReportDetailsth{border-bottom-color:#777777;border-bottom-style:solid;border-bottom-width:2px;}

.ReportDetailsOddDataRow{background-color:#dddddd;}

.ReportDetailsEvenDataRow{background-color:#eeeeee;}

.ReportTableHeaderCell{background-color:#dddddd;color:#47678E;vertical-align:top;font-size:80%;white-space:nowrap;}

.ReportTableValueCell{vertical-align:top;font-size:80%;white-space:nowrap;}

.ReportTableInfo{font-size:80%;font-style:italic;}

#ReportFooter{font-weight:bold;font-size:80%;text-align:right;background-color:#47678E;color:#eeeeee;margin-top:10px;padding:2px;border-bottom-style:solid;border-bottom-width:2px;border-top-style:solid;border-top-width:2px;border-color:#EBA525;}

#ReportFootera{color:#EBA525;text-decoration:none;}

</style>

</head>

Page 104: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

<body>

<divid="ReportHeader">

<xsl:iftest="header/title!=''">

<h1><xsl:value-ofselect="header/title"/></h1>

</xsl:if>

<xsl:iftest="header/generated!=''">

<b>Generated:</b><xsl:value-ofselect="header/generated"/><br/>

</xsl:if>

<xsl:iftest="header/server!=''">

<b>Server:</b><xsl:value-ofselect="header/server"/><br/>

</xsl:if>

<xsl:iftest="header/database!=''">

<b>Database:</b><xsl:value-ofselect="header/database"/><br/>

</xsl:if>

<xsl:iftest="header/catalog!=''">

<b>Catalog:</b><xsl:value-ofselect="header/catalog"/><br/>

</xsl:if>

<xsl:iftest="header/schema!=''">

<b>Schema:</b><xsl:value-ofselect="header/schema"/><br/>

</xsl:if>

<xsl:iftest="header/table!=''">

<b>Table:</b><xsl:value-ofselect="header/table"/><br/>

</xsl:if>

<xsl:iftest="header/job!=''">

<b>Job:</b><xsl:value-ofselect="header/job"/><br/>

</xsl:if>

</div>

<xsl:iftest="header/notes!=''">

<divid="ReportNotes">

<b>Notes:</b><br/><br/>

<xsl:call-templatename="substitute">

<xsl:with-paramname="string"select="header/notes"/>

</xsl:call-template>

</div>

</xsl:if>

<divid="ReportDetails">

Page 105: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

<xsl:apply-templatesselect="section">

<xsl:sortselect="@number"data-type="number"order="ascending"/>

</xsl:apply-templates>

</div>

<divid="ReportFooter">

Reportgeneratedby<ahref="http://www.enterprisedb.com/">PostgresEnterpriseManager&#8482;</a>

</div>

<br/>

</body>

</html>

</xsl:template>

<xsl:templatematch="section">

<xsl:iftest="../section[@id=current()/@id]/@name!=''">

<h2><xsl:value-ofselect="../section[@id=current()/@id]/@name"/></h2>

</xsl:if>

<xsl:iftest="count(../section[@id=current()/@id]/table/columns/column)>0">

<table>

<tr>

<xsl:apply-templatesselect="../section[@id=current()/@id]/table/columns/column">

<xsl:sortselect="@number"data-type="number"order="ascending"/>

<xsl:with-paramname="count"select="count(../section[@id=current()/@id]/table/columns/column)"/>

</xsl:apply-templates>

</tr>

<xsl:apply-templatesselect="../section[@id=current()/@id]/table/rows/*"mode="rows">

<xsl:sortselect="@number"data-type="number"order="ascending"/>

<xsl:with-paramname="column-meta"select="../section[@id=current()/@id]/table/columns/column"/>

</xsl:apply-templates>

</table>

<br/>

<xsl:iftest="../section[@id=current()/@id]/table/info!=''">

<pclass="ReportTableInfo"><xsl:value-ofselect="../section[@id=current()/@id]/table/info"/></p>

</xsl:if>

</xsl:if>

<xsl:iftest="../section[@id=current()/@id]/sql!=''">

<preclass="ReportSQL">

<xsl:call-templatename="substitute">

<xsl:with-paramname="string"select="../section[@id=current()/@id]/sql"/>

</xsl:call-template>

</pre>

</xsl:if>

</xsl:template>

Page 106: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

<xsl:templatematch="column">

<xsl:paramname="count"/>

<thclass="ReportTableHeaderCell">

<xsl:attributename="width"><xsl:value-ofselect="100div$count"/>%</xsl:attribute>

<xsl:call-templatename="substitute">

<xsl:with-paramname="string"select="@name"/>

</xsl:call-template>

</th>

</xsl:template>

<xsl:templatematch="*"mode="rows">

<xsl:paramname="column-meta"/>

<tr>

<xsl:choose>

<xsl:whentest="position()mod2!=1">

<xsl:attributename="class">ReportDetailsOddDataRow</xsl:attribute>

</xsl:when>

<xsl:otherwise>

<xsl:attributename="class">ReportDetailsEvenDataRow</xsl:attribute>

</xsl:otherwise>

</xsl:choose>

<xsl:apply-templatesselect="$column-meta"mode="cells">

<xsl:with-paramname="row"select="."/>

</xsl:apply-templates>

</tr>

</xsl:template>

<xsl:templatematch="*"mode="cells">

<xsl:paramname="row"/>

<tdclass="ReportTableValueCell">

<xsl:choose>

<xsl:whentest="$row/@*[name()=current()/@id]|$row/*[name()=current()/@id]!=''">

<xsl:call-templatename="substitute">

<xsl:with-paramname="string"select="$row/@*[name()=current()/@id]|$row/*[name()=current()/@id]"/>

</xsl:call-template>

</xsl:when>

<xsl:otherwise>

<xsl:text></xsl:text>

</xsl:otherwise>

</xsl:choose>

</td>

</xsl:template>

<xsl:templatename="substitute">

<xsl:paramname="string"/>

<xsl:paramname="from"select="'

Page 107: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

'"/>

<xsl:paramname="to">

<br/>

</xsl:param>

<xsl:choose>

<xsl:whentest="contains($string,$from)">

<xsl:value-ofselect="substring-before($string,$from)"/>

<xsl:copy-ofselect="$to"/>

<xsl:call-templatename="substitute">

<xsl:with-paramname="string"select="substring-after($string,$from)"/>

<xsl:with-paramname="from"select="$from"/>

<xsl:with-paramname="to"select="$to"/>

</xsl:call-template>

</xsl:when>

<xsl:otherwise>

<xsl:value-ofselect="$string"/>

</xsl:otherwise>

</xsl:choose>

</xsl:template>

</xsl:stylesheet>

SampleXMLData

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»ReportTool»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 108: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»ReportTool»

DefaultXSLStylesheet»

Page 109: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SampleXMLDataThe sample report below demonstrates the XML format that thepgadminReportToolwillproduce.

<?xmlversion="1.0"encoding="UTF-8"?>

<?xml-stylesheettype="text/xsl"href="C:\stylesheet.xsl"?>

<report>

<header>

<!--Allthevaluesintheheadersectionareoptional,apartfromthetitle.-->

<title>SampleXMLfile</title>

<notes>ThisisasampleXMLfile.</notes>

<generated>10/05/200611:21:23</generated>

<server>localhost:5432</database>

<database>postgres</database>

<schema>public</schema>

<table>pg_ts_cfg</table>

<job></job>

</header>

<!--Multiplereportsectionsmaybepresent,andmusthaveaname-->

<sectionid="s1"number="1"name="Queryresults">

<!--Atableisoptionalwithinasection.Ifpresent,thenumber-->

<!--ofcolumnsshouldbeappropriatefortheattributesspecified-->

<!--ineachrow.Arowneedn'tspecifyeveryvaluehowever.-->

<table>

<columns>

<columnid="c1"number="1"name="oid"/>

<columnid="c2"number="2"name="ts_name"/>

<columnid="c3"number="3"name="prs_name"/>

<columnid="c4"number="4"name="locale"/>

</columns>

<rows>

<rowid="r1"number="1"c1="17108"c2="default"c3="default"c4="C"/>

<rowid="r2"number="2"c1="17109"c2="default_russian"c3="default"c4="ru_RU.KOI8-R"/>

<rowid="r3"number="3"c1="17110"c2="simple"c3="default"c4=""/>

</rows>

Page 110: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

<!--Additionalsectionspecificinfomaybesupplied.-->

<info>3rowswith4columnsretrieved.</info>

</table>

<!--EachsectionmayalsocontainsomerelatedSQL.-->

<sql>SELECToid,*FROMpg_ts_cfg</sql>

</section>

</report>

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»ReportTool»

DefaultXSLStylesheet»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 111: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 112: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

DatabaseServerStatus

TheServerStatusdialoguedisplaysthecurrentconnectionstoeachdatabase, the user that is connected, the process ID, the clientaddressandstart time(onPostgreSQL8.1andabove),thecurrentquery being executed (if any), and the query start time (whereappropriate)onPostgreSQL7.4andaboveontheStatustab.

TheCancelbuttonallowscancellingthequeryrunningonaspecificbackend. Terminate will shutdown the backend. Attention: Bothfunctionsshouldbeusedcarefully,astheinterrupttheclient’sworkungracefully. Particularly, the terminate function might disturb thefunction of the complete server, force it to restart its services andthusinterruptalluserconnections.Youshouldusethisfunctiononlyif the server is seriously injured by a backend you can’t controlotherwise.

The Locks tab shows the current locks outstanding in thePostgreSQL Lock Manager. This information can be useful when

Page 113: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

attemptingtodebugortrackdowndeadlocksonyourserver.Notallinformation is necessarily shown for each lock. In particular, theRelationnamemaybeshownasanOID insteadofby it’sname, iftherelationisinadifferentdatabasetothatbeingmonitored.

Note:Whenthepg_locksviewisaccessedasisthecasewheneverthis dialgue is open, PostgreSQL’s internal lock manager datastructures are momentarily locked, and a copy is made for thedialogue to display. This ensures that the dialogue displays aconsistent set of results, while not blocking normal lock manageroperationslongerthannecessary.Nonethelesstherecouldbesomeimpactondatabaseperformanceifthisviewisreadoften.

On a PostgreSQL server running version 8.1 or newer, theTransaction tab allows you to view outstanding preparedtransactions. Prepared transactions are an aspect of Two PhaseCommit (2PC), used in distributed transaction managers. Usually,prepared transactions are handled by the transaction manager. Incase of a failure, it might be necessary to commit or rollback atransactionmanually;youcanusethe‘Commit’or‘Rollback’buttonstodothis.

The Logfile tab shows server log files, if configured inpostgresql.conf (redirect_stderr or logging_collector = true,log_destination = ‘stderr’ and log_filename = ‘postgresql-%Y-%m-%d_%H%M%S.log’ on PostgreSQL or ‘enterprisedb-%Y-%m-%d_%H%M%S.log’ onEnterpriseDB’sAdvancedServer). pgAdminwillextractatimestampfromthelogfileinaseparatecolumn,ifthelog_line_prefixisconfiguredaccordingly.Werecommendusing‘%t:’as format, because more complicate formats might not beinterpretablecorrectly.

The combobox allows you to select historic logfiles or the currentone. If “current” is selected, pgAdmin will correctly detect logfilerotationandcontinuetodisplaythem.

Page 114: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

The “Rotate” buttonwill force the server to rotate its server logfile.Thisfunctioniscurrentlynotimplementedon8.0servers;ifyouthinkthisisvaluableforyoupleasecontactus.

Please note that displaying the logfile requiresadditional functionsloadedontheserverside,whichareavailablefor8.xserversonly.

TorefreshthedisplayclicktheRefreshbutton.Thedisplaywillalsobe automatically refreshed based on the refresh interval specified.Notethatyouhaveonerefreshratepertab.

YoucanhidepanesbyclickingontheirclosebuttonorbyclickingontheappropiatemenuitemintheViewmenu.

Youcanalsocopysomelinesonthetabs’ list.Select the linesyouwanttocopyandclickontheCopybuttonofthetoolbar.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 115: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 116: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminOptionspgAdminhasaselectionofconfigurationoptionsthatyoucanusetopersonalizeyourworkspace.pgAdminisusuallyconfiguredbyusingtheOptionsdialogfromwithinthepgAdminapplication;toopentheOptionsdialogue,selectOptionsfromtheFilemenu.

Thenavigationpanelon theOptionsdialogcontainsa treecontrol;each node of the tree control provides access to customizableoptionsthatarerelatedtotheselectednode.For informationabouttheconfigurableoptionsoneachnodeof thepgAdmintreecontrol,pleaseselectfromthelinksshownbelow.

Contents:

pgAdminBrowserOptions

Page 117: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminQuerytoolOptionspgAdminDatabaseDesignerOptionspgAdminServerStatusOptionspgAdminMiscellaneousOptions

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 118: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

Page 119: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminBrowserOptionsUsetheoptionsthatarelocatedundertheBrowsernodeofthetreecontroltopersonalizeyourworkspace.

Use the options on the Display dialog to specify general displaypreferences:

Displaythefollowingdatabaseobjects-Checktheboxnextto a database object type to instruct pgAdmin to display theselected object type in the pgAdmin tree control. By default,pgAdmindisplaysonlythemostcommonlyusedobjecttypes.Default-Youcanreducethenumberofobjecttypesdisplayedto increase the speed of pgAdmin when querying the systemcatalogs. Use theDefault button to reset the list to its defaultsettings.

Page 120: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Use the options on the Properties dialog to specify displayproperties:

Count rows if estimated less than - Include a value in theCount rows if estimated less than field to perform a SELECTcount(*)iftheestimatednumberofrowsinatable(asreadfromthetablestatistics)isbelowthespecifiedlimit.AfterperformingtheSELECTcount(*),pgAdminwilldisplaytherowcount.

Page 121: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Use the options on the Binary paths dialog to specify binary filelocations:

Slony-Ipath -ToenablepgAdmin tocreateSlony-I replicationclusters fromscratch,youmustprovide thepath to theSlony-Iscriptinstallationdirectoryinthisfield.Ifnovalidscriptscanbefound,youwillonlybeallowedtojoinexistingclusters.PGbinpath-UsethisfieldtospecifythepathtothestandardPostgreSQL pg_dump, pg_restore and pg_dumpall utilities.pgAdminwilluse theseutilitieswhenbackingupand restoringyourPostgreSQLdatabases.Ifthispathisnotset,pgAdminwillattempttolocatetheutilitiesinitsinstallationdirectory,the‘hint’directory set by a local PostgreSQL installation (onWindows)andinthesystempath.EDB bin path - Use this field to specify the path to theEnterpriseDB pg_dump, pg_restore and pg_dumpall utilities.

Page 122: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminwilluse theseutilitieswhenbackingupand restoringyour EnterpriseDB databases. If this path is not set, pgAdminwill attempt to find the utilities in standard locations used byEnterpriseDB.GP bin path - Use this field to specify the path to theGreenplum pg_dump, pg_restore and pg_dumpall utilities.pgAdminwilluse theseutilitieswhenbackingupand restoringyourGreenplumdatabases.Ifthispathisnotset,pgAdminwillattempt to find the utilities in standard locations used byGreenplum.

Use the options on the UI Miscellaneous dialog to specifymiscellaneouspgAdminpreferences:

Font - Use the Font selector to specify the font used as thestandard font throughout pgAdmin’s main user interface. This

Page 123: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

maybeusefulforcountrieswithmultibytecharactersets(wherestandardfontsmaynotdisplaywell),orifyouwishtouseafontdifferentfromtheoneconfiguredonyoursystem.

Confirmobjectdeletion-SelectthisoptiontoinstructpgAdminto require confirmation before deleting an object(recommended).

ShowSystemObjectsinthetreeview-ChecktheboxnexttoShow System Objects in the treeview to instruct pgAdmin todisplay objects such as system schemas (e.g. pg_temp*) andsystemcolumns(e.g.xmin,ctid)inthetreecontrol.

Show users for privileges - Select this option to includeusernames aswell as groups in the subject list when viewingthePrivilegestabofanobjectthatsupportsprivileges.Disablingthisoptionisusefulonlargesystemswithmanyusersthatareorganisedingroups.

Showobjectpropertiesondoubleclickintreeview -Selectthis option to specify that double clicking an object in thetreeview should open the Properties dialogue for that object.Disablethisoptiontobrowsethetreeviewusingadouble-click.

Show NOTICEs - Check the box next to Show NOTICEs toinstructpgAdmintodisplaynoticesfromtheserver.

Refreshonclick -UsetheRefreshonclickdrop-down listboxto specify that thedisplayedpropertiesof the selectedobjectsshould be updated in the tree control when the object isselected.Selectfrom:

Nonetoupdatenoobjects.Refreshobjectonclicktorefreshtheselectedobject.Refresh object and children on click to refresh theselectedobject,andanyobjects thatresideunder the

Page 124: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

selectedobjectinthetreecontrol.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 125: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

Page 126: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminQuerytoolOptionsUse the options that are located under theQuery tool node of thetreecontroltopersonalizethebehavioroftheQuerytool.

Use the fields on the Query editor dialog to specify workspacepreferencesfortheQueryeditor:

Font - Use the Font selector to specify the font used in theQuerytoolinterface.Max characters per column - Use the Max characters percolumnfieldtospecifythemaximumlengthofdatadisplayedinasinglecolumn.Indentcharacters -Use the Indent characters field to specifythenumberofcharacterstoindentwithinSQLtextboxes.Use spaces instead of tabs - Check the box next to Use

Page 127: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

spaces instead of tabs to instruct pgAdmin to insert a spacewhenyoupressthetabkeyinanSQLtextbox.CopySQLfrommainformtoSQLdialogue-ChecktheboxnexttoCopySQLfrommainwindowtoSQLdialoguetoinstructpgAdmin to copy any object definition displayed on the mainobject browser for use as a default query in the Query ToolwhentheQueryToolopens.EnableAutoROLLBACK-ChecktheboxnexttoEnableAutoROLLBACKtoinstructthequerytooltoexecuteaROLLBACKifaqueryfails.Keywordsinuppercase -Checktheboxnext toKeywords inuppercase to instruct the Query tool to convert any keywordsenteredtoanuppercasefont.

Use the fieldsdisplayedon theColoursdialog toselectcolours foritemsdisplayedintheQuerytool:

Page 128: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Foreground/Background - Use the color selectors in theForeground/Background box to specify background andforegroundcolorsfortheQuerytool.Caret-UsethecolorselectorintheCaretboxtospecifyacolorforthecaret(orcursor).SQLSyntaxHighlighting-UsethecolorselectorsintheSQLSyntax Highlighting box to specify display colors for syntaxcomponents.

Use the fields on the Results Grid dialog to specify displaypreferencesfortheresultsgrid.

Resultcopyquoting-UsetheResultcopyquotingdrop-downlistbox to specify how fields in a result set should be quotedwhencopied to the clipboard from the result list.PleaseNoteDisabling thisoptionmayprevent copyingandpasting rows in

Page 129: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

theeditgrid from functioningproperly if the resultsetcontainsspecialcharacterslikelinebreaks.Specify:

Nonetoomitquoteswhencopied.Strings to quote string values when copied (numericcolumnswillnotbequoted).Alltoquoteallcopiedvalues(regardlessofdatatype).

Result copy quote character - Use the Result copy quotecharacter drop-down listbox to select a character that will beusedtoquotethevalueswhencopiedtotheclipboardfromtheresultlist.IthasnoeffectifResultcopyquotingissettoNone.

Result copy field separator - Use the Result copy fieldseparator drop-down listbox to select a character that will beused to separate the fields copied to the clipboard from theresultlist.

ShowNULLvaluesas<NULL>-ChecktheboxnexttoShowNULLvaluesas<NULL>tocauseNULLvaluestobeshownas<NULL> in theQuery Tool’s results grid. Note that this optiondoesnotaffectdatathatisexportedfromthegrid,onlywhatisdisplayed.

Page 130: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

UsethefieldsontheQueryFiledialogtospecifyUTF-8details,andfilesavingpreferences:

ReadandwriteUnicodeUTF-8 files -Check theboxnext toReadandwriteUnicodeUTF-8filestowriteUnicodeUTF-8filesbydefault.WriteBOMforUTFfiles-ChecktheboxnexttoWriteBOMforUTFfilestoinstructthequerytooltowriteabyteordermarkatthebeginningofeachfilewritten.Donotpromptforunsavedfilesonexit-ChecktheboxnexttoDonotprompt forunsaved filesonexit topreventpgAdminfrompromptingyoutosaveSQLqueriesuponexit.

Page 131: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Use the fieldson theFavouritesdialog tospecifya location for theQuerytool’sFavouritesfile:

Favouritesfilepath-TheFavouritesfilepathfieldspecifiesthepathtotheQuerytool’sFavouritesfile.Thedefaultfilenameispgadmin_favourites.xml;youcanusetheBrowsebuttontoopenafilebrowserandmodifythelocationofthefile.

Page 132: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Use the fields on theMacros dialog to specify a location for theQuerytool’sMacrosfile:

Macrosfilepath-TheMacrosfilepathfieldspecifiesthepathto the Query tool’s Macros file. The default file name ispgadmin_macros.xml;youcanusetheBrowsebuttontoopenafilebrowserandmodifythelocationofthefile.

Page 133: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

UsethefieldsontheHistoryFiledialogtospecifyuserpreferencesfortheQuerytool’shistoryfile:

Historyfilepath-TheHistoryfilepathspecifiesthepathtotheQuery tool’s history file. The default file name ispgadmin_histoqueries.xml; you can use the Browse button toopenafilebrowserandmodifythelocationofthefile.Maximum queries to store in history - Use the Maximumqueriestostoreinhistoryfieldtospecifythenumberofqueriesstored by pgAdmin.When themaximum number of queries isreached,theoldestquerywillbedeleted,andanewquerywillbestored.Maximum size of a stored query (in bytes) - Use theMaximum size of a stored query (in bytes) field to specify thesize (in bytes) of the largest query that will be stored in thehistoryfile;anyquerythatexceedsthespecifiedsizewillnotbe

Page 134: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

savedinthehistoryfile.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 135: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

Page 136: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminDatabaseDesignerOptionsUsetheoptionsthatarelocatedundertheDatabaseDesignernodeofthetreecontroltospecifyoptionsfortheDatabaseDesignertool.

Font - Open the font selector to specify the fonts displayedwithintheDatabaseDesignergraphicalinterface.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 137: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

Page 138: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminServerStatusOptionsUsetheoptionsthatarelocatedundertheServerStatusnodeofthetreecontroltocustomizeserverstatusdisplaypreferences.

Use the fields on the Server Status dialog to specify the colorsdisplayedtoindicatethestatusofaserver:

Idle Process Colour - Use the color selector to specify thedisplay color of an idle process. A process is considered idlewhentheserveriswaitingforanewcommand.ActiveProcessColour -Use thecolorselector tospecify thedisplay color of an active process. A process is consideredactivewhentheserverisexecutingaquery.Slow Process Colour - Use the color selector to specify thedisplay color of a slow process. A process is considered slow

Page 139: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

whenaqueryexceeds10seconds.BlockedProcessColour-Usethecolorselectortospecifythedisplay color of a blocked process. A process is consideredblockedanactivequeryiswaitingbecauseofalock.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 140: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

Page 141: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAdminMiscellaneousOptionsUsetheoptionsthatarelocatedundertheMiscellaneousnodeofthetreecontroltopersonalizethebehaviorofyourworkspace.

UsethefieldsontheUser Interfacedialogtospecifyuser interfacepreferences:

Userlanguage -Use theUser language drop-down listbox toselectthelanguagedisplayedinthepgAdminuserinterface.System schemas - pgAdmin will consider any schema (orschemas) listed in theSystem schemas field to be a systemschema.Tospecifythataschemaisasystemschema,includethe schema name in a list of comma-separated strings in theSystemschemasfield.

Page 142: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Use the fields on theHelp paths dialog to specify the locations ofhelp files.ThepathspecifiedmaybeaURLordirectorycontainingthe HTML format help files (note that some browsersmay requirefile:///path/to/local/files/ notation, while others require/path/to/local/files/ notation), or thepath to aCompiledHTMLHelp(.chm)file(onWindows),anHTMLHelpproject(.hhp)file,oraZiparchivecontainingtheHTMLfilesandtheHTMLHelpprojectfile.

PGhelppath-UsethePGhelppathfieldtospecifythepathtothePostgreSQLhelpfiles.PostgreSQLHelpfilesaredisplayedwhenPostgreSQL HELP is selected from the Help menu, orwhen accessing the help files throughmany database objectsonPostgreSQLservers.EDBhelppath -Use theEDBhelppathoption tospecify thepathtotheEnterpriseDBhelpfiles.EnterpriseDBHelpfilesaredisplayed whenEnterpriseDB Help is selected from the Help

Page 143: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

menu,orwhenaccessingthehelpfilesthroughmanydatabaseobjectsonEnterpriseDBservers.GPhelppath-UsetheGPhelppathoptiontospecifythepathtotheGreenplumhelpfiles.GreenplumHelpfilesaredisplayedwhen Greenplum Database Help is selected from the Helpmenu,orwhenaccessingthehelpfilesthroughmanydatabaseobjectsonGreenplumservers.Slonyhelppath-UsetheSlonyhelppathoptiontospecifythepathtotheSlonyhelpfiles.SlonyHelpfilesaredisplayedwhenSlonyHelpisselectedfromtheHelpmenu.

Bydefault,ifpgAdminsuspectsyoumightneedsupport,itdisplaysaguruhintwindow.UsethefieldsontheGuruhintsdialogtosuppressordisplayguruhints:

Donotshowguruhints;I’monemyself-Checktheboxnextto Do not show guru hints; I’m one myself to suppress this

Page 144: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

behaviour.Resetguruhints -Check theboxnext toResetguruhints toinstructpgAdmintodisplayallguruhintsuntilsuppressedagain.

Use the fields on the Logging dialog to specify the location andcontentofpgAdminlogfiles:

Logfile - Select this option to specify the name of the file inwhichpgAdminwillstoreanyloggingdata.Ifyouinclude%IDinthespecified filename, itwillbe replacedwith theprocess ID,allowing multiple instances of pgAdmin to run with logging toindividualfiles.Nologging-Nologgingwillbeperformedatall.Errorsonly-pgAdminwilllogerrorstothelogfile,butnothingelse.Errors and Notices - pgAdmin will log errors and noticemessagesfromPostgreSQLtothelogfile,butnothingelse.

Page 145: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Errors,Notices,SQL-Errormessages,noticemessagesfromPostgreSQLandSQLquerieswillbeloggedtothelogfile.Debug - Errormessages, noticemessages fromPostgreSQL,SQLqueriesanddebugmessageswillbeloggedtothelogfile.This option may significantly slow down pgAdmin, and isthereforenotrecommendedfornormaluse.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»pgAdmin

Options»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 146: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 147: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

GuruHintspgAdmin III has some functions included which should help toimplement healthy and good performing databases. They are theresult of the longexperienceof thedevelopersworldwide, and thedesignproblemscommonlyobserved.

If pgAdmin III thinks it hasa valuablehint for you, itwill popupaguruhintunlessyouhavechosentosuppressthatindividualhintorallhints(seeoptions).Youcanbringupthehintbypressingthehintbuttoninthetoolbaratanytime,ifenabled.

This is an example of a guru hint, as it appears when trying toconnecttoanon-runningormisconfiguredPostgreSQLserver.

Page 148: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Ifyoucheck‘donotshowthishintagain’,theautomaticpopupoftheindividualhintwillbesuppressedinthefuture,until it isresetintheoptions. Errormessageswill still appear, but without the extendedinformationasprovidedbythehints.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 149: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

Page 150: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

CommandLineParametersThereareanumberofcommandlineoptionsthatmaybepassedtothepgAdminexecutablewhenstartingit.

-hDisplaycommandlineoptionhelp.-s<serverdescription>Auto connect to the specified server.<serverdescription>isthedescriptionenteredwhenyouaddedthe server to the treeview in pgAdmin, quoted if required. Ifmultiple servers are registered with the same description, thefirstfoundwillbeauto-connected.-S Open a Server Status window upon connection. If usedtogether with the -s <server description> option, the serverstatuswindowwillautomaticallybeconnected to thisserver. Ifused alone, a dialog box will appear prompting for theconnection information. This switch cannot be used togetherwiththe-Sc<connectionstring>option.-Sc<connectionstring>OpenaServerStatuswindowuponconnection. The server status window will automatically beconnectedtotheserverspecifiedintheconnectionstring.Thisoptioncannotbeusedtogetherwiththe-Sswitch.-qOpenaQueryToolwindowuponconnection.Ifusedtogetherwith the -s <server description> option, the query tool willautomaticallybeconnectedtothisserver.Ifusedalone,adialogboxwill appear prompting for the connection information. Thisswitch cannot be used together with the -qc <connectionstring>option.-qc <connection string> Open a Query Tool window uponconnection. The query tool will automatically be connected totheserverspecifiedintheconnectionstring.Thisoptioncannotbeusedtogetherwiththe-qswitch.-f<SQLscript>AutomaticallyopenthespecifiedSQLscript intheQueryTool.Onlyusefulwith-qor-qc.

Page 151: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

-ch<hbafile>Editthespecifiedpg_hba.confconfigfile.-cm<configfile>Editthespecifiedpostgresql.confconfigfile.-cp<pgpassfile>Editthespecified.pgpass/pgpass.confconfigfile.-c<dir>Edittheconfigfilesinspecifiedclusterdirectory.-tStartindialoguetranslationtestmode.Thismodeallowseachdialogue tobeviewedwithout running theapplication toassistwithstringtranslation.

indexnext|previous|pgAdminIII1.16.1documentation»UsingpgAdminIII»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 152: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»

Page 153: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAgentIntroducedinpgAdminIIIv1.4,pgAgentisajobschedulingagentforPostgreSQL, capable of running multi-step batch/shell and SQLtasksoncomplexschedules.

FrompgAdmin1.9onwards,pgAgentisdistributedindependentlyofpgAdmin.Itmaybedownloadedfromthedownloadarea.

Contents:

pgAgentInstallationDatabasesetupDaemoninstallationonUnixServiceinstallationonWindowsSecurityconcerns

pgAgentJobspgAgentSchedulespgAgentSteps

indexnext|previous|pgAdminIII1.16.1documentation»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 154: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

Page 155: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAgentInstallationpgAgent runs as a daemon on Unix systems, and a service onWindowssystems.Inthemajorityofcasesitwillrunonthedatabaseserver itself - it is for this reason that pgAgent is not automaticallysetupwhenpgAdminisinstalled.Insomecaseshowever,itmaybepreferable to run pgAgent on multiple systems, against the samedatabase - individual jobsmaybe targettedat aparticular host, orleft for execution by any host. Locking prevents execution of thesameinstanceofajobbymultiplehosts.

Page 156: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

DatabasesetuppgAgent stores its configuration in the ‘postgres’ database in yourcluster.ThisdatabaseexistsbydefaultinPostgreSQL8.1versions,for earlier versions you need to create the database yourself. Thedatabase must have the pl/pgsql procedural language installed -PostgreSQL’s‘createlang’programcandothisifrequired.

Connect to the “postgres” database (once created if needed), andopentheSQLtool.SelecttheFile->Openoptionfromthemenuandfind the ‘pgagent.sql’ script installedwith pgAdmin. The installationlocation for this file varies from operating system to operatingsystem, however it will normally be found under ‘C:ProgramfilespgAdmin III’ on Windows systems (or ‘C:ProgramfilesPostgreSQL8.xpgAdmin III’ if installed with the PostgreSQLserver installer), or ‘/usr/local/pgadmin3/share/pgadmin3’ or‘/usr/share/pgadmin3’onUnixsystems.Oncethefileisloaded,clickthe‘Run’buttontoexecutethescript.

The script will create a number of tables and other objects in aschemacalled‘pgagent’.

Page 157: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

DaemoninstallationonUnixTo install thepgAgentdaemononaUnixsystem,youwillnormallyneed to have root privileges tomodify the system startup scripts -doingsoisquitesystemspecificsoyoushouldconsultyoursystemdocumentationforfurtherinformation.

Theprogramitselftakesfewcommandlineoptions-mostofwhichareonlyneededfordebuggingorspecialisedconfigurations:

Usage:

/path/to/pgagent[options]<connect-string>

options:

-frunintheforeground(donotdetachfromtheterminal)

-t<polltimeintervalinseconds(default10)>

-r<retryperiodafterconnectionabortinseconds(>=10,default30)>

-s<logfile(messagesareloggedtoSTDOUTifnotspecified)>

-l<loggingverbosity(ERROR=0,WARNING=1,DEBUG=2,default0)>

The connect string required is a standard PostgreSQL libpqconnection string (see the PostgreSQL documentation on theconnection string for further details). For example, the followingcommand lilne will run pgAgent against a server listening on thelocalhost,usingadatabasecalled‘pgadmin’,connectingastheuser‘postgres’:

/path/to/pgagenthostaddr=127.0.0.1dbname=postgresuser=postgres

Page 158: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ServiceinstallationonWindowspgAgent is able to self-install itself as a service on Windowssystems.ThecommandlineoptionsavailablearesimilartothoseonUnixsystems,butincludeanadditionalparametertotelltheservicewhattodo:

Usage:

pgAgentREMOVE<serviceName>

pgAgentINSTALL<serviceName>[options]<connect-string>

pgAgentDEBUG[options]<connect-string>

options:

-u<userorDOMAIN\user>

-p<password>

-d<displayname>

-t<polltimeintervalinseconds(default10)>

-r<retryperiodafterconnectionabortinseconds(>=10,default30)>

-l<loggingverbosity(ERROR=0,WARNING=1,DEBUG=2,default0)>

Theservicemaybequitesimplyinstalledfromthecommandlineasfollows(adjustingthepathasrequired):

"C:\ProgramFiles\pgAdminIII\pgAgent"INSTALLpgAgent-upostgres-psecrethostaddr=127.0.0.1dbname=postgresuser=postgres

Theservicemay thenbestarted from thecommand lineusingnetstartpgAgent,orfromtheServicescontrolpanelapplet.Anyloggingoutput or errors will be reported in the Application event log. TheDEBUG mode may be used to run pgAgent from a commandprompt. When run this way, log messages will output to thecommandwindow.

Page 159: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SecurityconcernspgAgent is a very powerful tool, but does have some securityconsiderationsthatyoushouldbeawareof:

Databasepassword-DONOTbetemptedtoincludeapasswordinthepgAgentconnectionstring-onUnixsystemsitmaybevisibletoallusersin‘ps’output,andonWindowssystemsitwillbestoredintheregistry inplain text. Instead,usea libpq~/.pgpass file tostorethepasswordsforeverydatabasethatpgAgentmustaccess.DetailsofthistechniquemaybefoundinthePostgreSQLdocumentationon.pgpassfile.

System/databaseaccess-alljobsrunbypgAgentwillrunwiththesecurity privileges of the pgAgent user. SQL steps will run as theuser that pgAgent connects to the database as, and batch/shellscriptswillrunastheoperatingsystemuserthatthepgAgentserviceor daemon is running under. Because of this, it is essential tomaintain control over the users that are able to create andmodifyjobs. By default, only the user that created the pgAgent databaseobjectswillbeabletodothis-thiswillnormallybethePostgreSQLsuperuser.

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 160: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

Page 161: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAgentJobspgAgent runs ‘jobs’, each ofwhich consists ofpgAgentSteps andpgAgentSchedules.Toconfigurejobsonyourserver,browsetotheserveronwhichthepgAgentdatabaseobjectswerecreated.AJobsnodewillbedisplayed,underwhichindividualjobsareshown.Newjobsmaybecreated,andexistingjobsmodifiedinthesamewayasanyotherobjectinpgAdmin.

The properties tab in the main pgAdmin window will display the

Page 162: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

detailsoftheselectedjob,andtheStatisticstabwillshowthedetailsofeachrunofthejob.

Jobthemselvesareverysimple-thecomplexityisinthestepsandschedules. When configuring a job, we specify the job name,whetherornot it isenabled,a jobclassorcategory,andoptionallythe hostname of a specific machine running pgAgent, if this jobshould only run on that specific server. If left empty (which isnormallythecase),anyservermayrunthejob.Thisisnotnormallyneeded forSQL-only jobs,howeverany jobswithbatch/shellstepsmayneedtobetargettedtoaspecificserver.Acommentmayalsobeincluded.

Note: It is not always obvious what value to specify for the HostAgent in order to target a job step to a specific machine. WithpgAgent running on the required machines and connected to thescheduler database, the following query may be run to view thehostnamesasreportedbyeachagent:

Page 163: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SELECTjagstationFROMpgagent.pga_jobagent

Use the hostname exactly as reported by the query in the HostAgentfield.

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 164: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

Page 165: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAgentSchedulesEach Job is executed according to one or more schedules. Eachtimethejoboranyof itsschedulesarealtered,thenextruntimeofthe job is re-calculated.Each instanceofpgAgentperiodicallypollsthe database for jobs with the next runtime value in the past. Bypollingat leastonceeveryminute,all jobswillnormallystartwithinone minute of the specified start time. If no pgAgent instance isrunningatthenextruntimeofajob,itwillrunassoonaspgAgentisnextstarted,followingwhichitwillreturntothenormalschedule.

Schedules may be added to a job through the job propertiesdialogue,oraddedasasub-object.TheProperties tabof themainpgAdminwindowwilldisplaydetailsoftheselectedschedule.

Page 166: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Eachscheduleconsistsofthebasicdetailssuchasaname,whetherornotitisenableandacomment.Inaddition,astartdateandtimeisspecified(beforewhichtheschedulehasnoeffect),andoptionallyanenddateandtime(afterwhichtheschedulehasnoeffect).

Page 167: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Schedulesarespecifiedusingacron-styleformat.Foreachselectedtime or date element, the schedule will execute. For example, toexecuteat5minutespasteveryhour,simply tick ‘5’ in theMinuteslistbox.Valuesfrommorethanonefieldmaybespecifiedinordertofurthercontrol theschedule.Forexample, toexecuteat12:05and14:05everyMondayandThursday,youwould tickminute5,hours12 and 14, and weekdays Monday and Thursday. For additionalflexibility, the Month Days check list includes an extra Last Dayoption.Thismatchesthe lastdayof themonth,whether ithappenstobethe28th,29th,30thor31st.

Page 168: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

On occasion it may be desirable to specify an exception for aschedule - for example, youmay notwant a schedule to fire on aparticularnationalholiday.Toachievethis,eachschedulemayhavea list of date and/or time exceptions attached to it. If a schedulelands on an exception, that instance will be skipped, and thefollowingoccurancewillbecomethenextruntime.

Page 169: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 170: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

Page 171: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

pgAgentStepsEachJobconsistsofanumberofsteps,eachofwhichmaybeanSQLscript,oranoperatingsystembatch/shellscript.Eachstepinagivenjobisruninturn,inalphanumericnameorder.

Stepsmaybeaddedtoajobthroughthejobpropertiesdialogue,oradded as a sub-object. The Properties tab of the main pgAdminwindowwilldisplaydetailsoftheselectedstep,andtheStatisticstabwill displaydetails of each runof the step, includingandoutput orerrorsfromthescript.

Each step consists of the details shown on the screenshot below,mostofwhichareself-explanatory.IfKindissettoSQL,thenitgoeswithoutsayingthatadatabaseagainstwhichtorunthescriptmustbe selected. If set toBatch, the database/connection string shouldbeleftblank.TheOnErroroptioncontrolshowfailureofthisstepwillaffectthestatusoftheoveralljob.

Page 172: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

TheDefinition tab contains a single text box into which the stepscriptshouldbeentered.ForSQLsteps, thisshouldbeaseriesofone or more SQL statements. For batch jobs, when running on aWindowsserver,standardbatchfilesyntaxmustbeused,andwhenrunningonanixserver,anyshellscriptmaybeused,providedthatasuitableinterpreterisspecifiedonthefirstline(e.g.*#!/bin/sh).

indexnext|previous|pgAdminIII1.16.1documentation»pgAgent»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 173: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»

Page 174: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Slony-IsupportpgAdminIIIincludesafrontendtoSlony-I,themostpopularmaster-slave replication solution for PostgreSQL. pgAdmin III makesmaintaining the replication setup easier, and features healthinformationtomonitorthestateofthecluster.

Contents:

Slony-IwithpgAdminIIIoverviewSlony-IadministrationwithpgAdminIII:installation

PrerequisitesOverviewCreateclusterandfirstnodeJoinadditionalnodestoclusterUpgradenodetonewclustersoftware

CreatingpathsandlistensCreatepathstoothernodesCreatelistenstoothernodes

CreatingsetsandsubscriptionsCreatereplicationsetDefinereplicatedtableDefinereplicatedsequenceSubscribeareplicationset

ExecuteDDLscriptswithSlony-ISlony-ItasksSlony-Iexample

For further information, please refer to the official Slony-Idocumentation <http://slony.info/documentation/> which isembeddedinthishelp.

indexnext|previous|pgAdminIII1.16.1documentation»

Page 175: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 176: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

Page 177: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Slony-IwithpgAdminIIIoverview

TheSlony-I objects are integrated into pgAdmin’smain object treebrowser, allowing a single interface to both database object andreplicationadministration.

The statistics tab for the nodes collection as well as for individualnodes show the status of the replication event queue, and allowsmonitoringofthefunctionalityoftheslonycluster.

Asanexample, thesituationshownabovedisplays thestatusofanodethathasn’tbeenresponsiveforaboutanhour,with381eventspendingtobereplicatedtothatnode.

Page 178: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 179: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

Page 180: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Slony-IadministrationwithpgAdminIII:installation

Page 181: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

PrerequisitesAs a prerequisite to running Slony-I on PostgreSQL, the slonymodulesxxidandslony1_funcsmustbepresentonallservers thathave to runaSlony-I replicationnode.This isusuallydoneby theSlony-Iinstallationroutine.

Page 182: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

OverviewSetting up Slony-I for the first time can be a daunting task. ThefollowingsectionsofthepgAdminhelpfilewillhelpguideyouthroughcreationofyourfirstcluster.

Step1:Createtheclusteronthemasternode.Step2:Addslavenodestothecluster.Step3:Setuppathsoneachnodetoallothernodes.Step4:Setuplistensoneachnodetoallothernodes(Note:NotrequiredwithSlony-Iv1.1orlater).Step5:Createareplicationset.Step6:Addtablesandsequencestotheset.Step7:Subscribetheslavestotheset.

NoteAtthispoint,theslondaemons(serviceenginesonWindows)shouldbestarted.

Page 183: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Createclusterandfirstnode

To install a Slony-I cluster on the first database, the “New Slony-ICluster”dialogisused.ItexecutestheofficialSlony-IclustercreationSQL scripts, which are located in the directory configured in theOptionsdialog.

pgAdminIIIneedstostoreinformationhowtocontacteachindividualnodeinthecluster.Toachievethis,pgAdminIIIusestheconceptof“Administrativenodes”.

Page 184: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Joinadditionalnodestocluster

After the first node in the Slony-I replication cluster has beensuccessfully created, all subsequent nodes take their configurationandproceduresfromthefirstnodes.Thisprocessiscalled“Joiningacluster” in pgAdmin III. Usually, you should also select an existingnodeasadminnode,toinsurelateraccessibilityfrompgAdminIII.

AfteryouaddedanewnodetotheSlony-Icluster,youneedtosetup replication paths between the nodes, to enable communicationbetweenthenodes.

Page 185: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Upgradenodetonewclustersoftware

When a cluster is to be upgraded to a new version of the Slony-Iclusteringsoftware,theupgradeprocesshastoberunonallnodesofthecluster.Foreachnode,theslondaemonneedstobestopped,thentheupgradedialogisstartedandanodewiththenewsoftwareisselected(pgAdminIIIwillextractallsoftwarefromthatnode),andfinallytheslondaemonisstartedagain.

Currently, pgAdmin III does not support upgrading from slonycreation scripts. Instead, create an intermediate cluster from thecreationscripts,useitasasourcefortheupgradedialog,anddroptheclusterafterusage.Youmayalsousethesloniktooltoupgradethe first node, and then use it as source for subsequent node

Page 186: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

upgrades.

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 187: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

Page 188: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Creatingpathsandlistens

Page 189: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Createpathstoothernodes

Slony-Ineedspathinformation,thatdefineshowaslonprocesscancommunicate to other nodes. The conninfo string takes a connectstringasdescribed in the libpqconnection documentation.Usually,you will need to specify host, dbname and username, while thepasswordshouldbestoredinthe.pgpassfile.

You must create a path to every other node, on each node. Forexample,inatwonodeclusteryouneedtocreateapathtotheslaveonthemaster,andonetothemasterontheslave.

Page 190: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Createlistenstoothernodes

Afterthecommunicationpathhasbeendefined,theslonprocessesneedtobeadvisedtolistentoeventsfromothernodes.

Note:ThisstepisnotnecessaryforSlony-Iv1.1andlater,becauselisteninformationisgeneratedautomaticallywhenpathsaredefined.

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 191: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

Page 192: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Creatingsetsandsubscriptions

Page 193: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Createreplicationset

Slony-I groups tables and sequences it has to replicate from amaster to slaves into replication sets. The set is created on thesourcenodeofthedata.

Page 194: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Definereplicatedtable

If the source table has triggers defined on it, these have to bedisabledonreplicationtargetnodes.Butinreplicationenvironments,the master and slave roles might exchange, so it is necessary toenable and disable triggers in those situations. The ‘Trigger’ pageallowsselectionoftriggersthatSlony-Ishouldenableanddisableifnecessary.

Attention: Ifa tableyou’d like tohavereplicateddoesn’tappear inthetablecombobox,thisusuallymeansthatthetablelacksauniqueindex. Slony-I requires that each row in tables that are to bereplicatedmustbeuniquelyidentifyable.Usually,thisshouldbedonewith a primary key, but for replication purposes a unique key issatisfactory.

While Slony-I has a helper function to define intermediate uniquekeys,thisisnotsupportedwithtablesaddedtoreplicationsetswithpgAdminIII.Westronglyrecommenddefiningaprimarykeyonthe

Page 195: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

tablestobereplicated.

Page 196: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Definereplicatedsequence

Thesequenceallowsaddingsequencestoareplicationset.

Page 197: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Subscribeareplicationset

After a replication set has been defined, it can be subscribed.Subscriptions have to be created on the source node (note: onSlony-1beforev1.1,thishadtobeperformedonthetargetnode).

After a set has been subscribed, its table and sequence definitioncan’tbechangedanymore.Toaddmore tables,youcancreateaset that includes the additional tables and sequences you’d like tohave added to the first replication set, then subscribe exactly thesamereceivernodestoit,andfinallyuseMergetomergebothsetsintoone.

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 198: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

Page 199: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ExecuteDDLscriptswithSlony-I

Most schema changes that can be executed with pgAdmin III arereplication-aware, i.e. you can advise pgAdmin III to apply thechange (create/alter) using the replication facilities, simply byselecting a replication set that is subscribed to all nodes whichshouldreceivethePostgreSQLobject.

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 200: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

Page 201: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Slony-ItasksIn the appropriate context, pgAdmin III can trigger severalmaintenancetasks.

Restartnode-Undersomeconditions,itmaybenecessarytorestart a slonprocessonanode, initializeas if freshly startedand make it reload its configuration. This can be triggeredremotelywiththerestartnodefunction.

Lockset -Disables updates to a set to be replicated. This isnecessaryforcleanswitchoverthesourceofareplicationfromonenodetoanother.

Unlockset-Re-enablesupdatestoasettobereplicatedafterapreviouslock.

Mergeset-Joinstwosets,originatingfromthesamenodeandsubscribedbythesamenodes,intoone.Thiscanbeusedasaworkaroundtothefactthatasubscribedsetcan’tbeextended.

Moveset -Movesa replicationset fromonenode toanother,i.e.making the target node thenewsource.Theold nodewillbecomesubscribertothenewprovidernode.Thisisthenormalwayhowtoswitchovergracefullythemasterrolefromonenodetoanother.

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 202: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

Page 203: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

Slony-IexampleInthisexample,amasterserverissetupwithtwodirectslaves.Thisexample was written and tested using Slony-I v1.2.11 andPostgreSQL8.2.5, running on a singleWindowsXPmachine. ThePostgresSQL pgbench utility is used to generate the test schemaandworkload.

1. Create 3 databases, master, slave1 and slave2 and ensurepl/pgsqlissetupineach.

2. Createapgbenchschemainthemasterdatabase:

>pgbench-i-Upostgresmaster

3. Addaprimarykeycalledhistory_pkeytothehistorytableonthetid,bidandaidcolumns

4. Createaschema-onlydumpofthemasterdatabase,andloaditintoslave1andslave2:

>pg_dump-s-Upostgresmaster>schema.sql

>psql-Upostgresslave1<schema.sql

>psql-Upostgresslave2<schema.sql

5. Create Slony config files for each slon engine (daemon onUnix).Thefilesshouldcontainjustthefollowingtwolines:

cluster_name='pgbench'

conn_info='host=127.0.0.1port=5432user=postgresdbname=master'

Create a file for each database, adjusting the dbnameparameterasrequiredandaddinganyotherconnectionoptionsthatmaybeneeded.

Page 204: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

6. (Windowsonly)InstalltheSlony-Iservice:

>slon-regserviceSlony-I

7. Register each of the engines (this is only necessary onWindows - on Unix the slon daemons may be startedindividuallyandgiventhepathtotheconfigfileonthecommandlineusingthe-foption):

>slon-addengineSlony-IC:\slony\master.conf

>slon-addengineSlony-IC:\slony\slave1.conf

>slon-addengineSlony-IC:\slony\slave2.conf

8. In pgAdmin under the Slony Replication node in the masterdatabase, create a new Slony-I cluster using the followingoptions:

Joinexistingcluster:Unchecked

Clustername:pgbench

Localnode:1Masternode

Adminnode:99Adminnode

9. Under the Slony Replication node, create a Slony-I cluster ineachoftheslavedatabasesusingthefollowingoptions:

Joinexistingcluster:Checked

Server:<Selecttheservercontainingthemasterdatabase>

Database:master

Clustername:pgbench

Localnode:10Slavenode1

Adminnode:99-Adminnode

Joinexistingcluster:Checked

Server:<Selecttheservercontainingthemasterdatabase>

Database:master

Clustername:pgbench

Localnode:20Slavenode2

Adminnode:99-Adminnode

10. CreatePathson themaster tobothslaves,andoneachslave

Page 205: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

back to themaster.Create thepathsunder eachnodeon themaster,usingtheconnectionstringsspecifiedintheslonconfigfiles. Note that future restructuring of the cluster may requireadditionalpathstobedefined.

11. Create a Replication Set on the master using the followingsettings:

ID:1

Comment:pgbenchset

12. Addthetablestothereplicationsetusingthefollowingsettings:

Table:public.accounts

ID:1

Index:accounts_pkey

Table:public.branches

ID:2

Index:branches_pkey

Table:public.history

ID:3

Index:history_pkey

Table:public.tellers

ID:4

Index:tellers_pkey

13. On themasternode,createanewsubscription foreachslaveusingthefollowingoptions:

Origin:1

Provider:1-Masternode

Receiver:10-Slavenode1

Origin:1

Provider:1-Masternode

Receiver:20-Slavenode2

14. Starttheslonservice(ordaemonsonUnix):

Page 206: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

>netstartSlony-I

Initialreplicationshouldbeginandcanbemonitoredonthestatisticstab in pgAdmin for each node. The pgbench utility may be runagainstthemasterdatabasetogenerateatestworkload.

indexnext|previous|pgAdminIII1.16.1documentation»Slony-Isupport»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 207: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»

Page 208: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ExtendedfeaturespgAdmin III’s functionality can be further enhanced using theadminpack contrib module for PostgreSQL. This is a library ofadditional functions that may be installed on your server whichallowspgAdmintoofferadditionalfeatures,suchas:

Thesizesondiskoftablespaces,databases,tablesandindexesaredisplayedontheStatisticstabinthemainwindow.TheStatusdialogueshouldbeabletodisplaytheserverlogfiles(ifloggingisappropriatelyconfigured).Running queries from other users may be cancelled from theStatusdialogue.Theserver’sconfigurationfilespostgresql.confandpg_hba.confmaybeeditted,andreloadedremotely.

The adminpack is installed and activated by default if you arerunning the ‘official’ pgInstaller distribution of PostgreSQL forWindows and is included as a contrib module with all versions ofPostgreSQL8.2andabove.However, if youare runninganyotherversionofPostgreSQLyouwillneedtomanuallyinstallit.Todoso,simplycopy theappropriateadminpacksourcecode to the /contribdirectory of your pre-configured PostgreSQL source tree. You candownloadtheadminpackshere.

Run the following commands (substituting admin for admin81 ifrequired):

#cd$PGSRC/contrib/admin

#makeall

#makeinstall

The module should now be built, and installed into your existingPostgreSQL installation. To be used, you must now install themodule into the database you use as pgAdmin’sMaintenanceDB

Page 209: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

(normally postgres, though you may wish to use a differentdatabase). To do so, locate the admin.sql or admin81.sql fileinstalled in the previous step - normally this may be found in/usr/local/pgsql/share/contrib/andrun itagainstyourdatabase.YouwillnormallyneedtodothisasthePostgreSQLsuperuser:

$psqlpostgres</usr/local/pgsql/share/contrib/admin.sql

ThenexttimeyouconnecttotheserverwithpgAdmin,itwilldetectthepresenceoftheadminpackandofferfullfunctionality.

SincePostgreSQL9.1,youdon’tneedtousepsql.YoucanmanuallyaddadminpackextensionormakepgAdmindothesamebyclickingonthe“FixIt!”buttonoftheguruhint.

indexnext|previous|pgAdminIII1.16.1documentation»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 210: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»

Page 211: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

AppendicesContents:

BugReportingThepgAdminDevelopmentTeamTranslationteamThePostgreSQLLicenceTheMITKerberosLicenceTheOpenSSLLicence

indexnext|previous|pgAdminIII1.16.1documentation»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 212: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

Page 213: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

BugReportingIfyouthinkyouencounteredabuginpgAdminIII,pleasecheckthefollowing:

Isthisbehaviourexpected?HavealookattheFAQs.Isthisbugalreadyreported?Checktheknownbugs.Areyourunningthelatestversionfromthebetawebsite?Ifnot,trytheneweststuff.

Ahh,soyou’vefoundanewonethen?

Postyourreporttothesupportmailinglist,andincludethefollowinginformations:

Platformyou’rerunningonLanguageDistributionyouused(sourcetarball,orbinary)VersionyoutestedIfpossibleandappropriate,includeabacktracefromthecrash.YoumayneedtorecompilewxWidgetsandpgAdminwiththe–enable-debugoptiontodothis.

Please donot send an email directly to one of the programmers;theymightmissit,orevenbethewrongpersonaltogether.

Usingthemailinglistguaranteesthatyourrequestisn’tlostandwillbeansweredinatimelyfashion.

Afterabughasbeen reportedon themailing list asbeing fixed, itmight takeoneor twodaysuntil ithasmade it into thedistributiontarballs,pleasebepatient.

ThanksforgivingpgAdmin3achance!

Page 214: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ThepgAdminDevelopmentTeam

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 215: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

Page 216: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ThepgAdminDevelopmentTeamVersion2.3,5March2009

1. Purpose

ThepgAdminDevelopmentTeamexistsfor2reasons:

1. TomanageandmaintainthepgAdminProject2. ToensurethatpgAdminremainsfreelyavailabletoanyone

thatwantsit.2. Structure

ThefoundationconsistsoftheProjectLeaderandMembers.

ProjectLeader:TheProjectLeaderisDavePage,founderandprimarydeveloperofthesoftware.TheProjectLeaderisalsoconsideredamember.Members:Members canbe any contributor to the projectwho accepts an invitation from the existing DevelopmentTeam.

3. DivisionofResponsibilities

Anymajordecision regarding theProjectmustbevotedonbytheDevelopmentTeam.Anyvotewillbemadeviaemailthroughtherelevantmailinglist.Responsesnotreceivedwithin2weekswillbediscountedfromthevote.

In the case of a hung vote, the Project Leader shall cast thedecidingvote.

4. People

ThepgAdminDevelopmentTeamincludesthefollowingpeople:

Dave Page (Project Leader): Project founder & primary

Page 217: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

developer.HiroshiSaito:ProducedaJapaneseportofpgAdminII,andcountlesspatchesforpgAdminIII.RaphaëlEnrici:Maintains theDebianport, andhelpswithnumerousotherissues.GuillaumeLelarge:Manages thepgAdminapplicationandwebsite translations, and has added a number ofenhancementstopgAdmin.Erwin Brandstetter: Spends significant amounts of timetestingnew releasesandhelpingus trackdownbugsandbehaviouralissues.MagnusHagander:Hasworkedonnumerousfeaturesandprojectinfrastructure.

The following people no longer work on the project, but weremaingratefulfortheirpastcontributions:

Mark Yeatman: Works on controls and consults on UIdesign.Frank Lupo: Has made countless improvements to thepgAdmin II code from minor bug fixes to majorenhancements.Jean-MichelPouré:translations&websitemanagement.Andreas Pflug: Has written vast amounts of pgAdmin IIIcodeandisresponsibleformuchofitsdesign.Adam H. Pendleton: Developed and maintains the buildsystem,andhelpswithvariousportingissues.

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 218: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

Page 219: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

TranslationteamWe are very grateful to those who commit time to translatingpgAdminIII.Hereisthelistoftranslators,orderedbylanguagecode:

af_ZA(Afrikaans)byPetriJoostebg_BG(Bulgarian)byMilenA.Radevca_ES(Catalan)byCarmeCerdaTorresde_DE(German)byHaraldArminMassaes_ES(Spanish)bymailto:[email protected]">DiegoA.Gilfi_FI(Finnish)byJoriJuotofr_FR(French)byGuillaumeLelargeandRaphaelEnricigl_ES(Galician)byAntonioRicoyRiegoit_IT(Italian)byGiuseppeSaccoja_JP(Japanese)byHiroshiSaitoko_KR(Korean)byKangHyeWonlv_LV(Latvian)byRudolfsMazursnl_NL(Dutch)byFredvanBemmelpl_PL(Polish)bySlawomirSudnikpt_BR(PortugueseBrazilian)byMarcosAlvesT.deAzevedopt_PT(Portuguese)byHelderM.Vieiraru_RU(Russian)byVladimirKazimirovsr_RS(Serbian)byBojanSkaljaczh_CN(Chinesesimplified)byChaoYi,Kuozh_TW(Chinesetraditional)byNSYSUMIS

Thereareother translations inprogress,youcancheckthecurrenttranslationstatusatourTranslationstatuspage.

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 220: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

Page 221: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ThePostgreSQLLicenceCopyright(C)2002-2012,ThepgAdminDevelopmentTeam

Permissiontouse,copy,modify,anddistributethissoftwareanditsdocumentation for any purpose, without fee, and without a writtenagreement is hereby granted, provided that the above copyrightnoticeandthisparagraphandthefollowingtwoparagraphsappearinallcopies.

INNOEVENTSHALLTHEPGADMINDEVELOPMENTTEAMBELIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDINGLOST PROFITS, ARISING OUT OF THE USE OF THISSOFTWAREANDITSDOCUMENTATION,EVENIFTHEPGADMINDEVELOPMENT TEAM HAS BEEN ADVISED OF THEPOSSIBILITYOFSUCHDAMAGE.

THE PGADMIN DEVELOPMENT TEAM SPECIFICALLYDISCLAIMSANYWARRANTIES, INCLUDING,BUTNOTLIMITEDTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY ANDFITNESS FOR A PARTICULAR PURPOSE. THE SOFTWAREPROVIDED HEREUNDER IS ON AN “AS IS” BASIS, AND THEPGADMIN DEVELOPMENT TEAM HAS NO OBLIGATIONS TOPROVIDE MAINTENANCE, SUPPORT, UPDATES,ENHANCEMENTS,ORMODIFICATIONS.

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 222: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

Page 223: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

TheMITKerberosLicencepgAdmin PostgreSQL’s libpq librarywhichmay be linkedwithMITKerberosLibrariesonsomedistributions.TheMITKerberoslicenceisincludedbelow:

Page 224: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

KerberosCopyrightThis software is being provided to you, the LICENSEE, by theMassachusetts Institute of Technology (M.I.T.) under the followinglicense.Byobtaining,usingand/orcopyingthissoftware,youagreethat you have read, understood, and will comply with these termsandconditions:

Permission touse,copy,modifyanddistribute thissoftwareand itsdocumentationforanypurposeandwithout feeorroyalty isherebygranted, provided that you agree to comply with the followingcopyright notice and statements, including the disclaimer, and thatthesameappearonALLcopiesofthesoftwareanddocumentation,including modifications that you make for internal use or fordistribution:

Copyright1992-2004by theMassachusetts InstituteofTechnology.Allrightsreserved.

THISSOFTWARE ISPROVIDED “AS IS”,ANDM.I.T.MAKESNOREPRESENTATIONSORWARRANTIES,EXPRESSORIMPLIED.By way of example, but not limitation, M.I.T. MAKES NOREPRESENTATIONS ORWARRANTIES OF MERCHANTABILITYORFITNESSFORANYPARTICULARPURPOSEORTHATTHEUSEOFTHELICENSEDSOFTWAREORDOCUMENTATIONWILLNOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,TRADEMARKSOROTHERRIGHTS.

ThenameoftheMassachusettsInstituteofTechnologyorM.I.T.mayNOTbeused inadvertisingorpublicity pertaining todistributionofthe software.Title to copyright in this softwareandanyassociateddocumentation shall at all times remain with M.I.T., and USERagreestopreservesame.

Page 225: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

ProjectAthena,Athena,AthenaMUSE,Discuss,Hesiod,Kerberos,Moira,OLC,XWindowSystem,andZephyrare trademarksof theMassachusettsInstituteofTechnology(MIT).Nocommercialuseofthese trademarksmaybemadewithout priorwrittenpermissionofMIT.

indexnext|previous|pgAdminIII1.16.1documentation»Appendices»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 226: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexprevious|pgAdminIII1.16.1documentation»Appendices»

Page 227: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

TheOpenSSLLicencepgAdminusescodefromtheOpenSSLprojecttoprovidesupportforSSL encrypted connections. The OpenSSL licence is includedbelow:

Copyright (c) 1998-2011 The OpenSSL Project. All rightsreserved.

Redistribution and use in source and binary forms,with orwithoutmodification,arepermittedprovidedthatthefollowingconditionsaremet:

Redistributionsofsourcecodemustretain theabovecopyrightnotice,thislistofconditionsandthefollowingdisclaimer.Redistributions in binary form must reproduce the abovecopyright notice, this list of conditions and the followingdisclaimerinthedocumentationand/orothermaterialsprovidedwiththedistribution.All advertising materials mentioning features or use of thissoftware must display the following acknowledgment: “Thisproduct includes software developed by the OpenSSL ProjectforuseintheOpenSSLToolkit.(http://www.openssl.org/)”Thenames“OpenSSLToolkit”and“OpenSSLProject”mustnotbe used to endorse or promote products derived from thissoftwarewithoutpriorwrittenpermission.Forwrittenpermission,[email protected] derived from this software may not be called“OpenSSL”normay “OpenSSL”appear in theirnameswithoutpriorwrittenpermissionoftheOpenSSLProject.Redistributionsofanyformwhatsoevermustretainthefollowingacknowledgment:“Thisproductincludessoftwaredevelopedbythe OpenSSL Project for use in the OpenSSL Toolkit(http://www.openssl.org/)”

Page 228: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

THISSOFTWAREISPROVIDEDBYTHEOpenSSLPROJECT‘’ASIS’’ AND ANY EXPRESSED OR IMPLIED WARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THEOpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FORANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES;LOSSOFUSE,DATA,ORPROFITS;ORBUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ORTORT (INCLUDINGNEGLIGENCEOROTHERWISE)ARISING INANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE.

Thisproduct includes cryptographic softwarewrittenbyEricYoung([email protected]).Thisproduct includessoftwarewrittenbyTimHudson([email protected]).

indexprevious|pgAdminIII1.16.1documentation»Appendices»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.

Page 229: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

indexpgAdminIII1.16.1documentation»

Page 230: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

IndexB|C|D|E|G|M|O|P|Q|R|S|V

Page 231: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

BBackup BugReporting

Page 232: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

CChangePasswordCommandLineParametersConnecttoserverConnectionerrors

ControlServerCreatingpathsandlistensCreatingsetsandsubscriptions

Page 233: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

DDatabaseServerStatus DefaultXSLStylesheet

Page 234: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

EEditDataExecuteDDLscriptswithSlony-I

Extendedfeatures

Page 235: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

GGrantWizardGraphicalQuerybuilder

GuruHints

Page 236: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

MMaintainadatabaseobject

Page 237: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

OObjectsearch

Page 238: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

PpgAdminBrowserOptionspgAdminDataExportpgAdminDatabaseDesignerOptionspgAdminDebuggerpgAdminMainWindowpgAdminMiscellaneousOptionspgAdminOptions

pgAdminQuerytoolOptionspgAdminServerStatusOptionspgAgentInstallationpgAgentJobspgAgentSchedulespgAgentStepspgScriptScriptingLanguageReference

Page 239: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

QQuerytool QueryToolMacros

Page 240: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

RReportTool Restore

Page 241: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

SSampleXMLDataSlony-IadministrationwithpgAdminIII:installationSlony-Iexample

Slony-IsupportSlony-ItasksSlony-IwithpgAdminIIIoverview

Page 242: pgAdmin III 1.16.1 documentation · pgAdmin III Contents: Introduction Using pgAdmin III pgAdmin Main Window Connect to server Change Password Control Server Query tool pgAdmin Debugger

VViewDataOptions

indexpgAdminIII1.16.1documentation»

©Copyright2002-2012,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.1.3.