pgadmin3 lts 1.23.0a documentation · using pgadmin iii this section explains how you can use...
TRANSCRIPT
indexnext|pgAdmin3LTS1.23.0adocumentation»
pgAdmin3Contents:
IntroductionUsingpgAdminIII
pgAdminMainWindowConnecttoserverChangePasswordControlServerQuerytoolpgAdminDebuggerpgAdminDataExportEditDataMaintainadatabaseobjectBackupSupportedFileFormatsTheBackupDialogRestoreTheRestoreDialogGrantWizardReportToolDatabaseServerStatuspgAdminOptionsGuruHintsCommandLineParameters
pgAgentpgAgentInstallationpgAgentJobspgAgentSchedulespgAgentSteps
Slony-IsupportSlony-IwithpgAdminIIIoverview
Slony-IadministrationwithpgAdminIII:installationCreatingpathsandlistensCreatingsetsandsubscriptionsExecuteDDLscriptswithSlony-ISlony-ItasksSlony-Iexample
ExtendedfeaturesAppendices
BugReportingThepgAdminDevelopmentTeamTranslationteamThePostgreSQLLicenceTheMITKerberosLicenceTheOpenSSLLicence
indexnext|pgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
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|pgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
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
BackupSupportedFileFormatsTheBackupDialogRestoreTheRestoreDialog
GrantWizardReportTool
DefaultXSLStylesheetDatabaseServerStatuspgAdminOptions
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|pgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
pgAdminMainWindow
Inthemainwindow,thestructureofthedatabasesisdisplayed.Youcan create new objects, delete and edit existing objects if theprivilegesoftheuserthatyouareusingonthecurrentconnectiontothedatabaseallowthis.
Theleftsideofthemainwindowshowsatreewithallservers,andtheobjectstheycontain.
Theupperrightsideshowsdetailsoftheobjectcurrentlyselectedinthe tree. Some objects might have statistics in addition to their
properties,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.
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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
MainWindow»
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’tclickonit.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
MainWindow»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
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, itmustbegin
witha“/”.Theportnumbermayalsobespecified.
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.
Youcanusethe“SSHTunneling” tabtoconnectpgAdmin(throughanintermediaryproxyhost)toaserverthatresidesonanetworktowhichtheclientmaynotbeabletoconnectdirectly.
Check the box next to “Use SSH tunneling?” to specifythatpgAdminshoulduseanSSHtunnelwhenconnectingtothespecifiedserver.SpecifythenameorIPaddressoftheSSHhost(throughwhichclientconnectionswillbeforwarded)intheTunnelhostfield.Specify the name of a user with connection privileges for theSSHhostintheUsernamefield.Specify the type of authentication that will be used whenconnectingtotheSSHhostintheAuthenticationfield.
Select the radio button next to Password to specify thatpgAdminwilluseapasswordforauthenticationbytheSSHhost.Thisisthedefault.Select the radio button next to Identity file to specify thatpgAdminwilluseaprivatekeyfilewhenconnecting.
IftheSSHhostisexpectingaprivatekeyfileforauthentication,usetheIdentityfilefieldtospecifythelocationofthekeyfile.If the SSH host is expecting a password, use thePassword/Passphrase field to specify a thepassword, or if anidentityfileisbeingused,specifythepassphrase.
The fourth tab contains some advanced options that are seldomlyused.
The“Connectnow?” fieldmakespgAdminattemptaconnectionassoonasyouhittheOKbutton.
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:
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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Connectto
server»
ConnectionerrorsWhen connecting to a PostgreSQL server, you might get errormessages that need some more explanations. If you encounterthem,pleasereadthefollowinginformationcarefully,we’resuretheywillhelpyou.
notrunningno-hba
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
serveracceptconnectionsonanyIPinterface.
For further information, please refer to the PostgreSQLdocumentationaboutruntimeconfiguration.
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.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Connectto
server»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
ChangePassword
Tochangeyourpassword,followthefollowingsteps:
1. EnteryourcurrentpasswordintheCurrentPasswordtextbox.2. EnteryourdesiredpasswordintheNewPasswordtextbox.3. Enter your desired password again, this time in the Confirm
Passwordtextbox.4. ClicktheOKbutton.
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 thatyouwillremembereasilybutotherswillnotguess.Ensure thatyourpassword ischangeregularly -at leasteveryninetydays.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
ControlServerIf youentered correct data in theServer property dialogue servicefield,pgAdminwillcheckiftheserviceisrunning,andallowstostartandstoptheservice.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
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 youselect*.*,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.
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.ShifttheselectedtexttouppercasebypressingControl+U.Shift the selected text to lower case by pressingControl+Shift+U.
If you prefer to build your queries graphically, you can use theGraphicalQuerybuildertogeneratetheSQLforyou.
Toexecuteaquery,selectExecutefromtheQuerymenu,presstheexecute toolbarbutton,orpress theF5 functionkey.Thecompletecontents of thewindowwill be sent to the database server, whichexecutesit.Youmayalsoexecutejustapartofthetext,byselectingonlythetextthatyouwanttheservertoexecute.
Options on the Query menu allow you to control COMMIT andROLLBACKbehaviorfortransactions:
Check the box next toAuto-Rollback to instruct the server toautomaticallyrollbackatransactionifanerroroccursduringthetransaction.Check the box next to Auto-Commit to instruct the server toautomatically commit each transaction.Any changesmade bythe transactionwill bevisible toothers,andareguaranteed tobe durable in the event of a crash. By default, auto-commitbehaviorisenabled.
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 canmodifythedegreeofinspectionbychangingtheExplainoptionsforthisintheQuerymenu.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 frompreviouscommandswillbediscarded.
TosavethedataintheDataOutputpagetoafile,youcanusetheExportdialog.
Information about all commands just executed will go to theMessages page. The History page will remember all commandsexecutedandtheresultsfromthis,untilyouuseClearHistoryfromtheQuerymenutoclearthewindow.Ifyouwanttoretainthehistoryforlaterinspection,youcansavethecontentsoftheHistorypageto
afileusingtheSavehistoryoptionfromtheQuerymenu.
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 retrievalofanunexpectedhighamountofdata.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-flowstructuresAdditionalfunctionsandproceduresRandomdatagenerators
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
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.Youcanadjusttherelativesizeofeachsectionbydraggingthejoin(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.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
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.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
pgScriptScriptingLanguageReference
OverviewpgScriptiscomposedofpgScriptcommands:
pgScriptcommand
:RegularPostgreSQLSQLCommand(SELECTINSERTCREATE...)
|Variabledeclarationorassignment(DECLARESET)
|Control-of-flowstructure(IFWHILE)
|Procedure(ASSERTPRINTLOGRMLINE)
Command names (SELECT, IF,SET, ...) are case-insensitive andmustbeendedwithasemi-column;.Identifiersarecase-sensitive.
Examples
Batchtablecreations
DECLARE@I,@T;--Variablenamesbeginwitha@
SET@I=0;--@Iisaninteger
WHILE@I<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<20
BEGIN
SET@T='table'+CAST(@IASSTRING);
SET@J=0;
WHILE@J<20
BEGIN
INSERTINTO@TVALUES(@G1,'@G2');
SET@J=@J+1;
END
SET@I=@I+1;
END
Batchtabledeletions
DECLARE@I,@T;--Declaringisoptional
SET@I=0;
WHILE1--Alwaystrue
BEGIN
IF@I>=20
BREAK;--Exittheloopif@I>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>
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
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:
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
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&firstcolumn
SET@R1[0][0]=1;--Samelocation
SET@R1[4]['@B']=1;--Fifthline&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];--Behaveslikesimple
SET@A=@R1[1];--@Abecomesarecordwhichisthefirstlineof
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):
SET@A=SELECT*FROMtable;--@Aisarecordwiththeresults
SET@B=INSERTINTOtable...;--@Bisaone-linerecordifthe
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
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'stringisconvertedto
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'.
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
Conditions
Conditionsare in fact resultsof operations.Forexample the stringcomparison'ab'='ac'will result inanumberwhich is false (theequalityisnottrue):
IF'ab'~='AB'--Case-insensitivecomparisonwhichresultin1(
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
--Thismeansthattableexistsotherwisetheconditionwould
END
Additionalfunctionsandprocedures
Procedures
Proceduresdonotreturnaresult.Theymustbeusedaloneonalineandcannotbeassignedtoavariable.
Printsanexpressiononthescreen:
PRINT'Thevalueof@Ais'+CAST(@AASSTRING);
Assert
Throwsanexceptioniftheexpressionevaluatedisfalse:
ASSERT5>3AND'a'='a';
Removeline
Removesthespecifiedlineofarecord:
RMLINE(@R[1]);--Removes@Rsecondline
Functions
Functionsdoreturnaresult.Theirreturnvaluecanbeassignedtoavariable,liketheCASToperation.
Trim
Removesextraspacessurroundingastring:
SET@A=TRIM('a');--@A='a'</pre>
Lines
Givesthenumberoflinesinarecord:
IFLINES(@R)>0
BEGIN
--Process
END
Columns
Givesthenumberofcolumnsinarecord:
IFCOLUMNS(@R)>0
BEGIN
--Process
END
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
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);
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
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[.
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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»Querytool
»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
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.Todebuganobject in-context, rightclick it in thepgAdminbrowser
treeview, 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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
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.
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:
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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»EditData»
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.
YoucanenteranarbitraryWHEREclause, to restrict the resultsetwhichisretrievedfromthedatabase.Youcanclick“Validate”tohavepgAdminIIItestwhethertheWHEREclauseisvalid.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»EditData»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
Maintainadatabaseobject
Thistoolallowstomaintainthedatabaseintotal,oronlyaselectedtable,oraselectedindex.
Maintenancecomesinthreeflavors.
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 ultimately degradingperformance.
PleasepresstheHelpbuttontoseethePostgreSQLhelpabouttheVACUUMcommandtolearnmoreabouttheoptions.
The output of the database server is displayed in the messagespageastheyarrive.IfVerboseisselected,theserverwillsendverydetailedinfoaboutwhatitdid.
Whilethistoolisveryhandyforad-hocmaintenancepurposes,youareencouragedtoinstallanautomaticjob,thatperformsaVACUUMjobregularlytokeepyourdatabaseinaneatstate.
ANALYZEANALYZEinvestigatesstatisticalvaluesabouttheselecteddatabaseortable.Thisenablesthequeryoptimizertoselectthefastestqueryplan,togiveoptimalperformance.Everytimeyourdataischangingradically, you should perform this task. It can be included in aVACUUMrun,usingtheappropriateoption.
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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
BackupThe Backup dialog provides an easy-to-use interface for thepg_dumppg_dumpcommand lineutility.Easy touseoptionsallowyoutobackupadatabase,aschemadefinition,data,orandatabaseobject.
ByselectingfieldsontheBackupdialog,youspecifywhichoptionsshould be included in a customized pg_dump command. Thepg_dump command writes an archive that you can use with thepgAdmin’s *Restore* dialog, the psql client , or pg_restore torecreatetheobjectsbackedupbythearchive.
Ifyouchoosetocreateaplain-textbackup,youcanreviewtheSQLcommands that build the selected object to better help youunderstandhowtheobjectwillberecreated.Youcanalsooptionallymodifythecontenttocreatenewdatabaseobjectsbeforerestoring.
SupportedFileFormatsThe drop-down listbox in theFormat field allows you to select anarchive format. Each format has advantages and disadvantages;selecttheformatthatisbestsuitedforyourapplication:
SelectPlain to generate a plain-text script file containingSQL statements and commands that you can execute atthe psql command line or with pg_dump to recreate thedatabase objects and load the table data. A plain-textbackup file can easily be edited in a text editor if desiredbefore restoring the database objects with the psqlprogram. Plain-text format is normally recommended forsmallerdatabases.SelectCustomtogenerateapg_dumpformattedbinaryfilethat allows for restorationof all or only selecteddatabaseobjects from the backup file. You can use pgAdmin torestorefromacustomarchivebackupfile.Acustomarchivebackup filecannotbeedited,butyoucanusepgAdmin toselectwhich database objects to restore from the backupfile.Customarchiveformatisrecommendedformediumtolarge databases from which you may want to select thedatabaseobjectstorestorefromthebackupfile.Select Tar to generate a tar archive file that allows forrestorationofalloronlyselecteddatabaseobjectsfromthebackup file. You can use pgAdmin to restore from a tararchivebackupfile.Select Directory to generate a directory-format archivesuitable for use with pgAdmin’s Restore dialog orpg_restore.Thisfileformatcreatesadirectorywithonefilefor each table and blob being dumped, plus a Table ofContents filedescribingthedumpedobjects inamachine-readable format that pg_restore can read. A directory
formatarchivecanbemanipulatedwithstandardUnixtools;for example, files in an uncompressed archive can becompressedwith thegzip tool.This format is compressedbydefaultandsupportsparalleldumps.
TheBackupDialogToopentheBackupdialog,rightclickonthenameofadatabaseora named object in the tree control and select Backup… from thecontextmenu.TheBackupdialogopens:
UsethefieldsontheFileOptionstabtospecifygeneralinformationaboutthebackup.
Enter the name of the backup file in the Filename field.Optionally, use the browser button to navigate into a directoryandselectafilethatwillcontainthearchive.Use thedrop-down listbox in theFormat field to select the fileformatforthebackup.UsetheCompressRatio field toselectacompression level forthe backup. Specify a value of zero to mean use no
compression; specify a maximum compression value of 9.Pleasenotethattararchivesdonotsupportcompression.UsetheEncodingdrop-downlistboxtoselecttheencodingthatshouldbeusedforthearchive.Use theNumberof Jobs field (whenapplicable) to specify thenumber of tables that will be dumped simultaneously in aparallelbackup.
Whenyou’vecompletedtheFileOptions tab,navigatetotheDumpOptions#1tab:
UsethefieldsontheDumpOptions#1 tab tospecifydetailsaboutthetypeofobjectsthatwillbebackedup:
Use thecheckboxes in theSections box to select a portionofthe object that will be backed up. By default, a backup willincludeallsections.
ChecktheboxnexttoPre-datatoincludealldatadefinitionitemsnotincludedinthedataorpost-dataitemlists.Check the box next toData to backup actual table data,large-objectcontents,andsequencevalues.Check the box next toPost-data to include definitions ofindexes,triggers,rules,andconstraintsotherthanvalidatedcheckconstraints.
Use the checkboxes in theType of Objects box to select theobjectsthatwillbeincludedinthebackup.Bydefault,allobjectswillbeincludedinthebackup.
ChecktheboxnexttoOnlydatatobackuponlythedata.Check the box next toOnly schema to back up only theschema(thedatadefinitions).ChecktheboxnexttoBlobstoincludelargeobjectsinthebackup.
UsethecheckboxesintheDon’tSaveboxtoselecttheobjectsthatwillnotbeincludedinthebackup.
Check the box next toOwner to omit commands that setobjectownership.Check the box next to Privilege to omit commands thatcreateaccessprivileges.ChecktheboxnexttoTablespacetoomittablespaces.Check the box next to Unlogged table data to omit thecontentsofunloggedtables.
Whenyou’vecompletedtheDumpOptions#1tab,selecttheDumpOptions#2tab:
UsethefieldsontheDumpOptions#2 tab tospecifydetailsaboutthestatementsusedwithinthebackupfile.
Use the checkboxes in theQueries box to specify the type ofstatementsthatshouldbeincludedinthebackup.
Check the box next to Include CREATE DATABASEstatementtoincludeacommandinthebackupthatcreatesanewdatabasewhenrestoringfromthebackup.ChecktheboxnexttoIncludeDROPDATABASEstatementtoincludeacommandinthebackupthatdropsanyexistingdatabasebeforerestoringfromthebackup.ChecktheboxnexttoUseColumnInsertstodumpthedatain the form of INSERT statements, with explicit columnnames. Please note: this may make restoration frombackupslow.Check theboxnext toUse Insert commands todump thedataintheformofINSERTstatementsratherthanusinga
COPY command.Please note: thismaymake restorationfrombackupslow.
Use the checkboxes in theDisable box to specify the type ofstatementsthatshouldbeexcludedfromthebackup.
ChecktheboxnexttoTrigger(activewhencreatingadata-onlybackup)toincludecommandsthatwilldisabletriggersonthetargettablewhilethedataisbeingloaded.Check the box next to$ quoting to disable dollar quotingwithinfunctionbodies;ifdisabled,thefunctionbodywillbequotedusingSQLstandardstringsyntax.
Use the checkboxes in the Miscellaneous box to specifymiscellaneousbackupoptions.
Check the box next to Use SET SESSIONAUTHORIZATION to include a statement that will use aSET SESSION AUTHORIZATION command to determineobject ownership (instead of an ALTER OWNERcommand).Check the box next to With OIDs to include objectidentifiersaspartofthetabledataforeachtable.Check the box next to Verbose messages to instructpg_dumptouseverbosemessages.ChecktheboxnexttoForcedoublequotesonidentifierstoforcethequotingofallidentifiers.
When you’ve completed the Dump Options #2 tab, select theObjectstab:
Use the fields on theObjects tab to select the objects thatwill beincluded in the backup; by default, when performing a databasebackup, all objects will be selected for inclusion in the archive.Deselectanobjectnametoexcludethatobjectfromthearchive.
Whenyou’vespecified thedetails thatwill be incorporated into thepg_dumpcommand,clicktheBackupbuttontobuildandexecuteacommandbasedon thosepreferences; the resultwill bedisplayedontheMessagestab:
Ifthebackupissuccessful,theMessagestabwilldisplay:
Processreturnedexitcode0.
Scroll up to review the pg_dump command used to generate thearchive,ortoviewanyerrormessagesthatwerereturnedduringthebackup.Whenyou’refinished,clickDonetoexittheBackupdialog.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
RestoreByselectingfieldsontheRestoredialog,youspecifywhichoptionsshould be included in a customized pg_restore command. Thepg_restore command plays back an archive that recreates thedatabase, databaseobject, or data describedby commandswithinthearchive.
IfyourarchiveisinaCustom,Tar,orDirectoryformat,youcanusetheRestoredialogtorestorefromthearchive.IfyouhavesavedthebackupinPlainformat,usethepsqlclienttorestore.
PleaseNote:Ifyouarerestoringintoanexistingdatabase,youmustensure thatanyobjects thatmight createconflictsbecauseofpre-existingconstraintsordependenciesaredroppedor truncated;usethe DROP CASCADE or TRUNCATE CASCADE options on thecontext menu to clean up existing conflicts before performing arestore.
TheRestoreDialogToopentheRestoredialog, rightclickon thenameofanobject inthe tree control and select Restore from the context menu. TheRestoredialogopens:
Use the fieldson theFileOptions tab to general informationaboutthebackuparchive.*UsetheFormatfieldtoselectthefileformatofthearchiveyouare restoring.pgAdmincan restore fromaCustomfile(pg_dumpformat),aTarfile,oraDirectoryformatfile.*UsetheFilenamefieldtospecifythenameofthebackuparchivethatwillbeused for the restore; optionally, use the file browser to navigate toand select the file. * Use theNumber of Jobs field to instruct theserver to usemultiple concurrent jobs for the restore. The optimalvalueforthisoptiondependsonthehardwaresetupoftheserver,oftheclient,andof thenetwork.Thisoption issupportedonlyby theCustomandDirectoryarchiveformats.*UsetheRolename field tospecify the name of the role that will be used when invokingpg_restore.
Whenyou’vecompletedtheFileOptionstab,navigatetotheRestoreOptions#1tab:
UsethefieldsontheRestoreOptions#1tabtospecifydetailsaboutthetypeofobjectsthatwillberestored.
Use thecheckboxes in theSections box to select a portionoftheobjectthatwillberestored.Bydefault,arestorewillincludeallsections.
ChecktheboxnexttoPre-datatoincludealldatadefinitionitemsnotincludedinthedataorpost-dataitemlists.Check the box next toData to include actual table data,large-objectcontents,andsequencevalues.Check the box next toPost-data to include definitions ofindexes,triggers,rules,andconstraintsotherthanvalidatedcheckconstraints.
Use the checkboxes in theType of Objects box to select theobjects that will be restored. By default, all objects will beincluded.
ChecktheboxnexttoOnlydatatorestoreonlythedata.
Check the box next to Only schema to restore only theschema(thedatadefinitions).
UsethecheckboxesintheDon’tSaveboxtoselecttheobjectsthatwillnotbeincluded.
Check the box next toOwner to omit commands that setobjectownership.Check the box next to Privilege to omit commands thatcreateaccessprivileges.ChecktheboxnexttoTablespacetoomittablespaces.
When you’ve completed the Restore Options #1 tab, select theRestoreOptions#2tab:
Use the checkboxes in the Queries box to specify how therestoreprocessshouldhandlestatements.
Check the box next to Include CREATE DATABASEstatementtoincludeacommandinthebackupthatcreatesanewdatabasewhenrestoringfromthebackup.Check theboxnext toCleanbefore restore to instruct theservertodropanobjectbeforerestoringitfromthearchive.
Please note that this option does not remove alldependencies for all objects; manual cleanup may berequiredbeforerestoringintoanexistingdatabase.Check the box next to Single transaction to execute therestore as a single transaction; this ensures that allcommands will complete successfully before the changesareapplied.
Use the checkboxes in theDisable box to specify trigger andtableloadingpreferences.
Check the box next toTrigger (when creating a data-onlybackup) to include commands thatwill disable triggers onthetargettablewhilethedataisbeingloaded.ChecktheboxnexttoNoDataforFailedTablestoinstructpg_restoretonotloadtabledataifthecreatecommandfora table fails. Specifying this option prevents duplicate orobsoletedatafrombeingloadedintoanexistingtable.
Use the checkboxes in the Miscellaneous Behavior box tospecifyadditionalrestoreoptions.
Check the box next to Use SET SESSIONAUTHORIZATION to use SQL-standard SET SESSIONAUTHORIZATION commands instead of ALTER OWNERcommandstodetermineobjectownership.ChecktheboxnexttoExitonErrortoexittherestoreifanerror isencounteredwhilesendingSQLcommands to thedatabase.Check the box next to Verbose messages to instructpg_restoretouseverbosemessages.
Whenyou’vecompletedtheRestoreOptions#2tab,navigatetotheObjectstab:
Click theDisplayobjects button topopulate the treecontrol on theObjects tab;when the listofobjects isdisplayed,check thebox totheleftofanobjectnametoincludethatobjectfromtherestore.
Whenyou’vecompletedthetabs,navigatetotheMessagestab,andpressOK.
When the restorationcompletes, theMessages tabdisplaysdetailsabouttherestorationprocess:
Iftherestorewassuccessful,theMessagestabwilldisplay:
Processreturnedexitcode0.
Ifyoureceiveanexitcodeotherthan0,scrollthroughtheMessageswindowtolocatetheproblem;aftercorrectingtheproblem,youcanrepeattheprocess.
Scroll to the top of the Messages dialog to view the executedpg_restore command.When you’re finished, clickDone to exit theRestoredialog.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
GrantWizard
TheGrantWizardallowsassignmentofasetofprivilegestogroupsand users to multiple objects (tables, sequences, views andfunctions)inaconvenientway.
TheSelectiontabwillshowallapplicableobjectsunderthecurrentlyselectedobject.Checkallobjectsyouliketograntprivilegeson.
Thesecuritytabdefinestheprivilegesandgroups/usersthatshouldbegranted.Assigningnoprivileges toagrouporuserwill result inrevokingallrightsforthem.
TheSQLtabshowsthesqlcommandsthataregeneratedfromthe
selectedgranttargets.
WhenclickingOK,thesqlcommandswillbeexecuted;anyresultwillbedisplayedintheMessagestab.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
ReportToolpgAdmin includes a simple reporting engine which allows you toquickly generate reports from the queries you write in the QueryTool,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
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.
WhengeneratingreportsinXMLformat,youcanopttooutputplainXML, XML linked to an external XSL stylesheet, or to process theXMLusinganexternalstylesheetandsavetheresultingoutput.Thisallowscompleteflexibilitytoformatreportsinanyway.
The default XSL stylesheet used to render XHTML output can beused as a starting point for your own, and sample XMLdatamayalsobereviewedifrequired.
Contents:
DefaultXSLStylesheetSampleXMLData
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»ReportTool
»
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;overflow:hidden;text-overflow:ellipsis;}
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>
<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">
<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™</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">
<divstyle=overflow:auto>
<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>
</div>
<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>
<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="'
'"/>
<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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»ReportTool
»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»ReportTool
»DefaultXSLStylesheet»
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>
<!--Additionalsectionspecificinfomaybesupplied.-->
<info>3rowswith4columnsretrieved.</info>
</table>
<!--EachsectionmayalsocontainsomerelatedSQL.-->
<sql>SELECToid,*FROMpg_ts_cfg</sql>
</section>
</report>
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»ReportTool
»DefaultXSLStylesheet»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
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
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.
The “Rotate” buttonwill force the server to rotate its server logfile.Thisfunctioniscurrentlynotimplementedon8.0servers;ifyouthinkthisisvaluableforyoupleasecontactus.
Please note that displaying the logfile requires additional functionsloadedontheserverside,whichareavailablefor8.xserversonly.
TorefreshthedisplayclicktheRefreshbutton.Thedisplaywillalsobe automatically refreshed based on the refresh interval specified.Notethatyouhaveonerefreshratepertab.
YoucanhidepanesbyclickingontheirclosebuttonorbyclickingontheappropiatemenuitemintheViewmenu.
Youcanalsocopysomelinesonthetabs’ list.Select the linesyouwanttocopyandclickontheCopybuttonofthetoolbar.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
pgAdminOptionspgAdminhasaselectionofconfigurationoptionsthatyoucanusetopersonalizeyourworkspace.pgAdminisusuallyconfiguredbyusingtheOptionsdialogfromwithinthepgAdminapplication;toopentheOptionsdialogue,selectOptionsfromtheFilemenu.
Thenavigationpanelon theOptionsdialogcontainsa treecontrol;each node of the tree control provides access to customizableoptionsthatarerelatedtotheselectednode.For informationabouttheconfigurableoptionsoneachnodeof thepgAdmintreecontrol,pleaseselectfromthelinksshownbelow.
Contents:
pgAdminBrowserOptionspgAdminQuerytoolOptionspgAdminDatabaseDesignerOptions
pgAdminServerStatusOptionspgAdminMiscellaneousOptions
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
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.
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.
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.pgAdminwilluse theseutilitieswhenbackingupand restoringyour EnterpriseDB databases. If this path is not set, pgAdminwill attempt to find the utilities in standard locations used by
EnterpriseDB.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. Thismaybeusefulforcountrieswithmultibytecharactersets(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 theselectedobjectinthetreecontrol.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
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
spaces instead of tabs to instruct pgAdmin to insert a spacewhenyoupressthetabkeyinanSQLtextbox.
CopySQL frommainwindow toSQLdialogue -Check thebox next toCopy SQL frommain window to SQL dialogue toinstructpgAdmintocopyanyobjectdefinitiondisplayedonthemainobjectbrowserforuseasadefaultqueryintheQueryToolwhentheQueryToolopens.
EnableAutoROLLBACK-ChecktheboxnexttoEnableAutoROLLBACKtoinstructthequerytooltoexecuteaROLLBACKifaqueryfails.
Enable Auto COMMIT - Check the box next to Enable AutoCOMMIT to instruct thequery tool toenableautocommitafterexecutingthequery.
Keywordsinuppercase -Checktheboxnext toKeywords inuppercase to instruct the Query tool to convert any keywordsenteredtoanuppercasefont.
Externalformattingutility -UsetheExternal formattingutilityfieldtoprovidethenameofaformattingtoolthatcanbeusedtomakequeriesmorereadable.UseofatoolthatprovidessupportforUTF-8multi-bytecharactersisnotrequired,butispreferable.Theutilitymust:
AcceptaSTDINstreamandwritetheresultsettoSTDOUTProvidearesultinlessthan3secondsExitwithacode0onsuccess
TouseanexternalformattingtoolintheQueryEditor:
Provide the name of the formatting tool in the ExternalformattingutilityfieldoftheOptionsdialogue.IntheQueryEditor,selectablockoftextforformatting,and
PressCtrl+Shift+f,ornavigatethroughtheEditmenutotheFormatmenu,andselectExternalFormat.
Use the fieldsdisplayedon theColoursdialog toselectcolours foritemsdisplayedintheQuerytool:
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 intheeditgrid 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.
Thousandsseparator -Use theThousandsseparator field tospecifyadelimitercharacter thatwillbeused tobreakavalueintogroupsofthreedigits,countingleftfromthedecimalmark.
Decimal mark - Use the Decimal mark field to specify adelimitercharacter thatwillbeused tobreakanumber intoanintegerportionandafractionalportion.
Copy column names - Check the box next toCopy columnnames to specify that when copying from the result grid, thecolumnnameshouldbeincludedasthefirstrow.
UsethefieldsontheQueryFiledialogtospecifyUTF-8details,andfilesavingpreferences:
ReadandwriteUnicodeUTF-8 files -Check theboxnext toReadandwriteUnicodeUTF-8filestowriteUnicodeUTF-8filesbydefault.WriteBOMforUTFfiles-ChecktheboxnexttoWriteBOMforUTFfilestoinstructthequerytooltowriteabyteordermarkatthebeginningofeachfilewritten.Donotpromptforunsavedfilesonexit-ChecktheboxnexttoDonotprompt forunsaved filesonexit topreventpgAdminfrompromptingyoutosaveSQLqueriesuponexit.
Use the fieldson theFavouritesdialog tospecifya location for theQuerytool’sFavouritesfile:
Favouritesfilepath-TheFavouritesfilepathfieldspecifiesthepathtotheQuerytool’sFavouritesfile.Thedefaultfilenameispgadmin_favourites.xml;youcanusetheBrowsebuttontoopenafilebrowserandmodifythelocationofthefile.
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.
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;anyquerythatexceedsthespecifiedsizewillnotbesavedinthehistoryfile.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
pgAdminDatabaseDesignerOptionsUsetheoptionsthatarelocatedundertheDatabaseDesignernodeofthetreecontroltospecifyoptionsfortheDatabaseDesignertool.
Font - Open the font selector to specify the fonts displayedwithintheDatabaseDesignergraphicalinterface.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
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 slowwhenaqueryexceeds10seconds.BlockedProcessColour-Usethecolorselectortospecifythe
display color of a blocked process. A process is consideredblockedanactivequeryiswaitingbecauseofalock.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
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.
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 Helpmenu,orwhenaccessingthehelpfilesthroughmanydatabaseobjectsonEnterpriseDBservers.GPhelppath-UsetheGPhelppathoptiontospecifythepath
totheGreenplumhelpfiles.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 thisbehaviour.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.Errors,Notices,SQL-Errormessages,noticemessagesfromPostgreSQLandSQLquerieswillbeloggedtothelogfile.Debug - Errormessages, noticemessages fromPostgreSQL,SQLqueriesanddebugmessageswillbeloggedtothelogfile.This option may significantly slow down pgAdmin, and isthereforenotrecommendedfornormaluse.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»pgAdmin
Options»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
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.
Ifyoucheck‘donotshowthishintagain’,theautomaticpopupoftheindividualhintwillbesuppressedinthefuture,until it isresetintheoptions. Errormessageswill still appear, but without the extendedinformationasprovidedbythehints.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
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.
NOTE: The “password” connection string option will not berecognised for security reasons.PleaseuseaPGPASSFILE ifyouneedtostoretheconnectionpassword.
-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.
NOTE: The “password” connection string option will not berecognised for security reasons.PleaseuseaPGPASSFILE ifyouneedtostoretheconnectionpassword.
-f<SQLscript>AutomaticallyopenthespecifiedSQLscript intheQueryTool.Onlyusefulwith-qor-qc.
-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|pgAdmin3LTS1.23.0adocumentation»UsingpgAdminIII»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
pgAgentIntroducedinpgAdminIIIv1.4,pgAgentisajobschedulingagentforPostgreSQL, capable of running multi-step batch/shell and SQLtasksoncomplexschedules.
FrompgAdmin1.9onwards,pgAgentisdistributedindependentlyofpgAdmin.Itmaybedownloadedfromthedownloadarea.
Contents:
pgAgentInstallationDatabasesetupDaemoninstallationonUnixServiceinstallationonWindowsSecurityconcerns
pgAgentJobspgAgentSchedulespgAgentSteps
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»pgAgent»
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.
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.Iftheserveris9.1orlater,andpgAgent3.4.0orlater,simplypasteinthisqueryandclickthe‘Run’button:
CREATEEXTENSIONpgagent;
Thiscommandwillcreateanumberoftablesandotherobjectsinaschemacalled‘pgagent’.
For earlier versions of PostgreSQL or pgAgent, select the File ->Openoptionfromthemenuandfindthe‘pgagent.sql’scriptinstalledwith pgAdmin. The installation location for this file varies fromoperating system to operating system, however it will normally befound under ‘C:Program filespgAdmin III’ onWindows systems (or‘C:Program filesPostgreSQL8.xpgAdmin III’ if installed with thePostgreSQL server installer), or‘/usr/local/pgadmin3/share/pgadmin3’ or ‘/usr/share/pgadmin3’ onUnix systems. Once the file is loaded, click the ‘Run’ button toexecutethescript.
The script will create a number of tables and other objects in aschemacalled‘pgagent’.
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,default
-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
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,default
-l<loggingverbosity(ERROR=0,WARNING=1,DEBUG=2,default0)
Theservicemaybequitesimplyinstalledfromthecommandlineasfollows(adjustingthepathasrequired):
"C:\ProgramFiles\pgAdminIII\pgAgent"INSTALLpgAgent-upostgres
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.
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|pgAdmin3LTS1.23.0adocumentation»pgAgent»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»pgAgent»
pgAgentJobspgAgent runs ‘jobs’, each ofwhich consists of pgAgentSteps andpgAgentSchedules.Toconfigurejobsonyourserver,browsetotheserveronwhichthepgAgentdatabaseobjectswerecreated.AJobsnodewillbedisplayed,underwhichindividualjobsareshown.Newjobsmaybecreated,andexistingjobsmodifiedinthesamewayasanyotherobjectinpgAdmin.
The properties tab in the main pgAdmin window will display thedetailsoftheselectedjob,andtheStatisticstabwillshowthedetails
ofeachrunofthejob.
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:
SELECTjagstationFROMpgagent.pga_jobagent
Use the hostname exactly as reported by the query in the HostAgentfield.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»pgAgent»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»pgAgent»
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.
Eachscheduleconsistsofthebasicdetailssuchasaname,whetherornotitisenableandacomment.Inaddition,astartdateandtimeisspecified(beforewhichtheschedulehasnoeffect),andoptionallyanenddateandtime(afterwhichtheschedulehasnoeffect).
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.
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.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»pgAgent»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»pgAgent»
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.
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|pgAdmin3LTS1.23.0adocumentation»pgAgent»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
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|pgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
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.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
Slony-IadministrationwithpgAdminIII:installation
PrerequisitesAs a prerequisite to running Slony-I on PostgreSQL, the slonymodulesxxidandslony1_funcsmustbepresentonallservers thathave to runaSlony-I replicationnode.This isusuallydoneby theSlony-Iinstallationroutine.
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.
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”.
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.
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
upgrades.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
Creatingpathsandlistens
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.
Createlistenstoothernodes
Afterthecommunicationpathhasbeendefined,theslonprocessesneedtobeadvisedtolistentoeventsfromothernodes.
Note:ThisstepisnotnecessaryforSlony-Iv1.1andlater,becauselisteninformationisgeneratedautomaticallywhenpathsaredefined.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
Creatingsetsandsubscriptions
Createreplicationset
Slony-I groups tables and sequences it has to replicate from amaster to slaves into replication sets. The set is created on thesourcenodeofthedata.
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
tablestobereplicated.
Definereplicatedsequence
Thesequenceallowsaddingsequencestoareplicationset.
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|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
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|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
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|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
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.
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:<Selecttheservercontainingthemaster
Database:master
Clustername:pgbench
Localnode:10Slavenode1
Adminnode:99-Adminnode
Joinexistingcluster:Checked
Server:<Selecttheservercontainingthemaster
Database:master
Clustername:pgbench
Localnode:20Slavenode2
Adminnode:99-Adminnode
10. CreatePathson themaster tobothslaves,andoneachslave
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):
>netstartSlony-I
Initialreplicationshouldbeginandcanbemonitoredonthestatisticstab in pgAdmin for each node. The pgbench utility may be runagainstthemasterdatabasetogenerateatestworkload.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Slony-Isupport»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
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
(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|pgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
AppendicesContents:
BugReportingThepgAdminDevelopmentTeamTranslationteamThePostgreSQLLicenceTheMITKerberosLicenceTheOpenSSLLicence
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Appendices»
BugReportingIfyouthinkyouencounteredabuginpgAdminIII,pleasecheckthefollowing:
Isthisbehaviourexpected?HavealookattheFAQs.Isthisbugalreadyreported?Checktheknownbugs.Areyou running the latestversion from thewebsite? 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!
ThepgAdminDevelopmentTeam
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Appendices»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Appendices»
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
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|pgAdmin3LTS1.23.0adocumentation»Appendices»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Appendices»
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|pgAdmin3LTS1.23.0adocumentation»Appendices»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Appendices»
ThePostgreSQLLicenceCopyright(C)2002-2016,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|pgAdmin3LTS1.23.0adocumentation»Appendices»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Appendices»
TheMITKerberosLicencepgAdmin PostgreSQL’s libpq librarywhichmay be linkedwithMITKerberosLibrariesonsomedistributions.TheMITKerberoslicenceisincludedbelow:
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.
ProjectAthena,Athena,AthenaMUSE,Discuss,Hesiod,Kerberos,Moira,OLC,XWindowSystem,andZephyrare trademarksof theMassachusettsInstituteofTechnology(MIT).Nocommercialuseofthese trademarksmaybemadewithout priorwrittenpermissionofMIT.
indexnext|previous|pgAdmin3LTS1.23.0adocumentation»Appendices»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexprevious|pgAdmin3LTS1.23.0adocumentation»Appendices»
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/)”
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|pgAdmin3LTS1.23.0adocumentation»Appendices»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.
indexpgAdmin3LTS1.23.0adocumentation»
IndexB|C|D|E|G|M|O|P|Q|R|S|V
BBackup BugReporting
CChangePasswordCommandLineParametersConnecttoserver
ConnectionerrorsControlServerCreatingpathsandlistensCreatingsetsandsubscriptions
DDatabaseServerStatus DefaultXSLStylesheet
EEditData ExecuteDDLscriptswithSlony-I
Extendedfeatures
GGrantWizard GraphicalQuerybuilder
GuruHints
MMaintainadatabaseobject
OObjectsearch
PpgAdminBrowserOptionspgAdminDataExportpgAdminDatabaseDesignerOptionspgAdminDebuggerpgAdminMainWindowpgAdminMiscellaneousOptionspgAdminOptions
pgAdminQuerytoolOptionspgAdminServerStatusOptionspgAgentInstallationpgAgentJobspgAgentSchedulespgAgentStepspgScriptScriptingLanguageReference
QQuerytool QueryToolMacros
RReportTool Restore
SSampleXMLDataSlony-IadministrationwithpgAdminIII:installationSlony-Iexample
Slony-IsupportSlony-ItasksSlony-IwithpgAdminIIIoverview
VViewDataOptions
indexpgAdmin3LTS1.23.0adocumentation»
©Copyright2002-2016,ThepgAdminDevelopmentTeam.CreatedusingSphinx1.4.8.