Update pgaccess 0.98
2
HISTORY
@@ -103,7 +103,7 @@ Detailed Change List
|
||||
when reach end of pattern before end of text(Tom)
|
||||
Repair incorrect cleanup of heap memory allocation during transaction
|
||||
abort(Tom)
|
||||
|
||||
Updated version of pgaccess 0.98
|
||||
|
||||
Release 6.5.1
|
||||
|
||||
|
@@ -59,6 +59,7 @@ Irix linking fix from Yu Cao <yucao@falcon.kla-tencor.com>
|
||||
Repair logic error in LIKE: should not return LIKE_ABORT
|
||||
when reach end of pattern before end of text(Tom)
|
||||
Repair incorrect cleanup of heap memory allocation during transaction abort(Tom)
|
||||
Updated version of pgaccess 0.98
|
||||
</programlisting>
|
||||
</para>
|
||||
</sect2>
|
||||
|
@@ -1,21 +0,0 @@
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Makefile
|
||||
# Makefile for pgaccess
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# IDENTIFICATION
|
||||
# $Header: /cvsroot/pgsql/src/bin/pgaccess/Attic/Makefile,v 1.1 1998/12/18 17:54:42 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
SRCDIR= ../..
|
||||
include $(SRCDIR)/Makefile.global
|
||||
|
||||
.PHONY: all clean
|
||||
all clean:
|
||||
|
||||
.PHONY: install
|
||||
install: pgaccess.tcl
|
||||
$(INSTALL) $(INSTL_EXE_OPTS) pgaccess.tcl $(BINDIR)/pgaccess
|
@@ -1,167 +0,0 @@
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1994-7 Regents of the University of California
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose, without fee, and without a written agreement
|
||||
is hereby granted, provided that the above copyright notice and this
|
||||
paragraph and the following two paragraphs appear in all copies.
|
||||
|
||||
IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
|
||||
LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
|
||||
DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
|
||||
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
|
||||
PGACCESS 0.96 9 March 1999
|
||||
================================
|
||||
I dedicate this program to my little daughters Ana-Maria and Emilia and to my
|
||||
wife for their understanding. I hope they will forgive me for spending so many
|
||||
time far from them.
|
||||
|
||||
|
||||
|
||||
1.Why PgAccess ?
|
||||
|
||||
First of all because PostgreSQL lacks a graphical interface where you
|
||||
can manage your tables, edit them, define queries, sequences and
|
||||
functions.
|
||||
|
||||
|
||||
|
||||
2.How to INSTALL ?
|
||||
|
||||
You will need Tcl/Tk package, I am using now Tcl 7.6 and Tk 4.2.
|
||||
PgAccess is running fine also on Tcl/Tk 8.0
|
||||
|
||||
Also, you will need the PostgreSQL to Tcl interface library, lined as a
|
||||
Tcl/Tk 'load'-able module. It is called libpgtcl and the source is
|
||||
located in the PostgreSQL directory /src/interfaces/libpgtcl.
|
||||
Specifically, you will need a libpgtcl library that is 'load'-able from
|
||||
Tcl/Tk. This is technically different from an ordinary PostgreSQL
|
||||
loadable object file, because libpgtcl is a collection of object files.
|
||||
|
||||
Under Linux, this is called libpgtcl.so. You will find a pre-compiled
|
||||
copy of it for Linux i386 systems at : http://www.flex.ro/pgaccess.
|
||||
Just copy libpgtcl.so into your system library directory /usr/lib or
|
||||
/lib and go for it.
|
||||
|
||||
Under Windows, copy libpgtcl.dll and libpq.dll into C:\WINDOWS\SYSTEM directory.
|
||||
Make sure you have Tcl/Tk at least version 8.0.0 for Microsoft Windows 95 & NT.
|
||||
PgAccess has been checked with Tcl/Tk 8.0.4 version on Windows95 and Windows98
|
||||
platforms.
|
||||
|
||||
Tcl/Tk 8.0.4 for Windows95 & NT can be downloaded from
|
||||
ftp://ftp.scriptics.com/pub/tcl/tcl8_0/tcl804.exe
|
||||
It is 1833712 bytes long.
|
||||
|
||||
|
||||
3.How to run it?
|
||||
|
||||
You run it with the command:
|
||||
|
||||
wish -f pgaccess.tcl [database]
|
||||
|
||||
[database] is optional.
|
||||
|
||||
Another way of loading the PostgreSQL library is running it with pgwish.
|
||||
It's a wish compiled with libpgtcl library so it could understand the
|
||||
commands for working with PostgreSQL. For this, remove the line "load
|
||||
libpgtcl.so" from the source. If your operating system has a different
|
||||
library name or location, change the 'load libpgtcl.so' line in the
|
||||
pgaccess.tcl file.
|
||||
|
||||
|
||||
4.What does it now ?
|
||||
|
||||
- Opens any database on a specified host at the specified port, username and password
|
||||
- Perform vacuum command.
|
||||
- Saves preferences in ~/.pgaccessrc file
|
||||
|
||||
Tables
|
||||
- opening multiple tables for viewing, max n records (configurable)
|
||||
- column resizing by dragging the vertical grid lines
|
||||
- text will wrap in cells now
|
||||
- dynamic row height when editing
|
||||
- table layout saved for every table
|
||||
- import/export to external files (SDF,CSV)
|
||||
- filter capabilities ,enter filter like price>3.14
|
||||
- sort order capabilities ,enter manually the sort field(s)
|
||||
- editing in place, double click the text you want to change
|
||||
- record deleting , point the record, press Del key
|
||||
- adding new records ,save new row with right-button-click on table for the moment
|
||||
- table generator assistant
|
||||
- table renaming and deleting (dropping)
|
||||
- table information retrieving : owner, field information, indexes
|
||||
|
||||
Queries
|
||||
- define, edit and store "user defined queries"
|
||||
- save view layout
|
||||
- can store queries as views
|
||||
- execution of queries with optional user input parameters ( select * from invoices where year=[parameter "Year of selection"] )
|
||||
- viewing of select type queries result
|
||||
- running action queries (insert, update, delete)
|
||||
- visual query builder with drag & drop support, table aliasing
|
||||
|
||||
Sequences
|
||||
- define
|
||||
- inspect
|
||||
- delete
|
||||
|
||||
Views
|
||||
- defining them saving queries as views
|
||||
- view them , with filtering and sorting capabilities
|
||||
- design views
|
||||
- delete them
|
||||
|
||||
Functions
|
||||
- define , inspect , delete
|
||||
|
||||
Reports
|
||||
- simple reports from a table (beta stage)
|
||||
- change font,size and style of fields and labels
|
||||
- load and save reports from the database
|
||||
- table previews, sample postscript print
|
||||
|
||||
Forms
|
||||
- open user defined forms
|
||||
- form design module available
|
||||
- query widget allowing access to a record set
|
||||
|
||||
Scripts
|
||||
- define, modify and call user defined scripts
|
||||
|
||||
5.What it should do in the future ?
|
||||
|
||||
- sequence and function renaming
|
||||
- more powerful report generator and viewer
|
||||
- help on line
|
||||
|
||||
|
||||
|
||||
6. How you should report the errors?
|
||||
First of all : operating system, PostgreSQL version,Tcl/Tk version.
|
||||
A more detailed story of what have you done when error had occurred.
|
||||
Tcl/Tk stops usually with a error message and there is a button there
|
||||
"Stack Trace" and if you press it, you will see a detailed information
|
||||
about the place where it stuck. Please send it to me.
|
||||
Some information about table structure, no. of fields, records would
|
||||
be also good.
|
||||
|
||||
===========================================================================
|
||||
You would find always the latest version at http://www.flex.ro/pgaccess
|
||||
|
||||
Please feel free to e-mail me with any suggestion or bug description
|
||||
that will help to improve it.
|
||||
|
||||
Constantin Teodorescu <teo@flex.ro>
|
||||
|
Before Width: | Height: | Size: 207 B |
@@ -1,39 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; Linux 2.0.30 i586) [Netscape]">
|
||||
<TITLE>PgAccess - Copyright notice</TITLE>
|
||||
</HEAD>
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
<TT>---------------------------------------------------------------------------</TT>
|
||||
<BR><TT></TT>
|
||||
<BR><TT></TT> <TT></TT>
|
||||
|
||||
<P><TT>Copyright (c) 1994-7 Regents of the University of California</TT><TT></TT>
|
||||
|
||||
<P><TT>Permission to use, copy, modify, and distribute this software and
|
||||
its</TT>
|
||||
<BR><TT>documentation for any purpose, without fee, and without a written
|
||||
agreement</TT>
|
||||
<BR><TT>is hereby granted, provided that the above copyright notice and
|
||||
this</TT>
|
||||
<BR><TT>paragraph and the following two paragraphs appear in all copies.</TT><TT></TT>
|
||||
|
||||
<P><TT>IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
|
||||
PARTY FOR</TT>
|
||||
<BR><TT>DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
||||
INCLUDING</TT>
|
||||
<BR><TT>LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS</TT>
|
||||
<BR><TT>DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
|
||||
OF THE</TT>
|
||||
<BR><TT>POSSIBILITY OF SUCH DAMAGE.</TT><TT></TT>
|
||||
|
||||
<P><TT>THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,</TT>
|
||||
<BR><TT>INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY</TT>
|
||||
<BR><TT>AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER
|
||||
IS</TT>
|
||||
<BR><TT>ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
|
||||
TO</TT>
|
||||
<BR><TT>PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.</TT>
|
||||
</BODY>
|
||||
</HTML>
|
233
src/bin/pgaccess/demo/formdemo.sql
Normal file
@@ -0,0 +1,233 @@
|
||||
CREATE SEQUENCE "cities_id_seq" start 7 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ;
|
||||
SELECT nextval ('cities_id_seq');
|
||||
CREATE TABLE "pga_queries" (
|
||||
"queryname" character varying(64),
|
||||
"querytype" character,
|
||||
"querycommand" text,
|
||||
"querytables" text,
|
||||
"querylinks" text,
|
||||
"queryresults" text,
|
||||
"querycomments" text);
|
||||
CREATE TABLE "pga_forms" (
|
||||
"formname" character varying(64),
|
||||
"formsource" text);
|
||||
CREATE TABLE "pga_scripts" (
|
||||
"scriptname" character varying(64),
|
||||
"scriptsource" text);
|
||||
CREATE TABLE "pga_reports" (
|
||||
"reportname" character varying(64),
|
||||
"reportsource" text,
|
||||
"reportbody" text,
|
||||
"reportprocs" text,
|
||||
"reportoptions" text);
|
||||
CREATE TABLE "phonebook" (
|
||||
"name" character varying(32),
|
||||
"phone_nr" character varying(16),
|
||||
"city" character varying(32),
|
||||
"company" bool,
|
||||
"continent" character varying(16));
|
||||
CREATE TABLE "pga_layout" (
|
||||
"tablename" character varying(64),
|
||||
"nrcols" int2,
|
||||
"colnames" text,
|
||||
"colwidth" text);
|
||||
CREATE TABLE "pga_schema" (
|
||||
"schemaname" character varying(64),
|
||||
"schematables" text,
|
||||
"schemalinks" text);
|
||||
REVOKE ALL on "pga_schema" from PUBLIC;
|
||||
GRANT ALL on "pga_schema" to PUBLIC;
|
||||
CREATE TABLE "cities" (
|
||||
"id" int4 DEFAULT nextval('"cities_id_seq"') NOT NULL,
|
||||
"name" character varying(32) NOT NULL,
|
||||
"prefix" character varying(16) NOT NULL);
|
||||
REVOKE ALL on "cities" from PUBLIC;
|
||||
GRANT UPDATE,DELETE,SELECT,RULE on "cities" to "fane";
|
||||
GRANT ALL on "cities" to "liviu";
|
||||
CREATE FUNCTION "getcityprefix" (int4 ) RETURNS varchar AS 'select prefix from cities where id = $1 ' LANGUAGE 'SQL';
|
||||
COPY "pga_queries" FROM stdin;
|
||||
Query that can be saved as view S select * from phonebook where continent='usa' \N \N \N \N
|
||||
\.
|
||||
COPY "pga_forms" FROM stdin;
|
||||
Phone book pb 28 {FS {}} 444x307+284+246 {label label1 {33 10 68 28} {} Name {} label1 flat #000000 #d9d9d9 1 n} {entry name_entry {87 9 227 27} {} entry2 DataSet(.pb.qs,name) name_entry sunken #000000 #fefefe 1 n} {label label3 {33 37 73 52} {} Phone {} label3 flat #000000 #d9d9d9 1 n} {entry entry4 {87 36 195 54} {} entry4 DataSet(.pb.qs,phone_nr) entry4 sunken #000000 #fefefe 1 n} {label label5 {33 64 78 82} {} City {} label5 flat #000000 #d9d9d9 1 n} {entry entry6 {87 63 195 81} {} entry6 DataSet(.pb.qs,city) entry6 sunken #000000 #fefefe 1 n} {query qs {3 6 33 33} {} query7 {} qs flat {} {} 1 n} {button button8 {174 177 246 203} {namespace eval DataControl(.pb.qs) {\
|
||||
\ setSQL "select oid,* from phonebook where name ~* '$what' order by name"\
|
||||
\ open\
|
||||
\ set nrecs [getRowCount]\
|
||||
\ updateDataSet\
|
||||
\ fill .pb.allnames name\
|
||||
\ bind .pb.allnames <ButtonRelease-1> {\
|
||||
\ set ancr [.pb.allnames curselection]\
|
||||
\ if {$ancr!=""} {\
|
||||
\ \ DataControl(.pb.qs)::moveTo $ancr\
|
||||
\ \ DataControl(.pb.qs)::updateDataSet\
|
||||
\ }\
|
||||
\ }\
|
||||
}} {Start search} {} button8 raised #000000 #d9d9d9 1 n} {button button9 {363 276 433 300} {DataControl(.pb.qs)::close\
|
||||
DataControl(.pb.qs)::clearDataSet\
|
||||
set nrecs {}\
|
||||
set what {}\
|
||||
destroy .pb\
|
||||
} Exit {} button9 raised #000000 #d9d9d9 2 n} {button button10 {291 237 313 257} {namespace eval DataControl(.pb.qs) {\
|
||||
\ moveFirst\
|
||||
\ updateDataSet\
|
||||
}\
|
||||
} |< {} button10 ridge #000092 #d9d9d9 2 n} {button button11 {324 237 346 257} {namespace eval DataControl(.pb.qs) {\
|
||||
\ movePrevious\
|
||||
\ updateDataSet\
|
||||
}\
|
||||
} << {} button11 ridge #000000 #d9d9d9 2 n} {button button12 {348 237 370 257} {namespace eval DataControl(.pb.qs) {\
|
||||
\ moveNext\
|
||||
\ updateDataSet\
|
||||
}} >> {} button12 ridge #000000 #d9d9d9 2 n} {button button13 {381 237 403 257} {namespace eval DataControl(.pb.qs) {\
|
||||
\ moveLast\
|
||||
\ updateDataSet\
|
||||
}\
|
||||
} >| {} button13 ridge #000088 #d9d9d9 2 n} {checkbox checkbox14 {33 87 126 105} {} {Is it a company ?} DataSet(.pb.qs,company) checkbox14 flat #000000 #d9d9d9 1 n} {radio usa {63 108 201 120} {} U.S.A. DataSet(.pb.qs,continent) usa flat #000000 #d9d9d9 1 n} {radio europe {63 126 204 141} {} Europe DataSet(.pb.qs,continent) europe flat #000000 #d9d9d9 1 n} {radio africa {63 144 210 159} {} Africa DataSet(.pb.qs,continent) africa flat #000000 #d9d9d9 1 n} {entry entry18 {129 180 169 198} {} entry18 what entry18 sunken #000000 #fefefe 1 n} {label label19 {108 219 188 234} {} {records found} {} label19 flat #000000 #d9d9d9 1 n} {label label20 {90 219 105 234} {} { } nrecs label20 flat #000000 #d9d9d9 1 n} {label label21 {3 252 33 267} {} OID= {} label21 flat #000000 #d9d9d9 1 n} {label label22 {39 252 87 267} {} { } pbqs(oid) label22 flat #000000 #d9d9d9 1 n} {button button23 {9 276 79 300} {set oid {}\
|
||||
catch {set oid $DataSet(.pb.qs,oid)}\
|
||||
if {[string trim $oid]!=""} {\
|
||||
sql_exec noquiet "update phonebook set name='$DataSet(.pb.qs,name)', phone_nr='$DataSet(.pb.qs,phone_nr)',city='$DataSet(.pb.qs,city)',company='$DataSet(.pb.qs,company)',continent='$DataSet(.pb.qs,continent)' where oid=$oid"\
|
||||
} else {\
|
||||
tk_messageBox -title Error -message "No record is displayed!"\
|
||||
}\
|
||||
\
|
||||
} Update {} button23 raised #000000 #d9d9d9 1 n} {button button24 {210 276 280 300} {set thisname $DataSet(.pb.qs,name)\
|
||||
if {[string trim $thisname] != ""} {\
|
||||
\ sql_exec noquiet "insert into phonebook values (\
|
||||
\ \ '$DataSet(.pb.qs,name)',\
|
||||
\ \ '$DataSet(.pb.qs,phone_nr)',\
|
||||
\ \ '$DataSet(.pb.qs,city)',\
|
||||
\ \ '$DataSet(.pb.qs,company)',\
|
||||
\ \ '$DataSet(.pb.qs,continent)'\
|
||||
\ )"\
|
||||
\ tk_messageBox -title Information -message "A new record has been added!"\
|
||||
} else {\
|
||||
\ tk_messageBox -title Error -message "This one doesn't have a name?"\
|
||||
}\
|
||||
\
|
||||
} {Add record} {} button24 raised #000000 #d9d9d9 1 n} {button button25 {141 276 204 300} {DataControl(.pb.qs)::clearDataSet\
|
||||
# clearcontrols stillinitialise\
|
||||
# incorectly booleans controls to {}\
|
||||
# so I force it to 'f' (false)\
|
||||
set DataSet(.pb.qs,company) f\
|
||||
focus .pb.name_entry} {Clear all} {} button25 raised #000000 #d9d9d9 1 n} {listbox allnames {249 6 435 231} {} listbox26 {} allnames sunken #000000 #fefefe 1 n} {label label27 {33 252 90 267} {} {} DataSet(.pb.qs,oid) label27 flat #000000 #d9d9d9 1 n} {label label28 {3 182 128 197} {} {Find name containing} {} {} flat #000000 #d9d9d9 1 n}
|
||||
Full featured form full 21 {FS {set entrydemo {nice}\
|
||||
set color {no color selected}}} 377x418+50+130 {label label1 {3 396 165 411} {} {Status line} {} {} sunken #000000 #d9d9d9 2 n} {label label2 {171 396 369 411} {} {Grooved status line} {} {} groove #000098 #d9d9d9 2 f} {label label3 {108 9 270 31} {} { Full featured form} {} {} ridge #000000 #d9d9d9 4 {Times 16 bold italic}} {button button4 {15 210 144 243} {.full.lb insert end {it's} a nice demo form} {Java style button} {} {} groove #6161b6 #d9d9d9 2 b} {label label5 {15 42 115 58} {} {Java style label} {} {} flat #6161b6 #d9d9d9 1 b} {entry entry6 {123 39 279 60} {} entry6 entrydemo {} groove #000000 #fefefe 2 {Courier 13}} {listbox lb {12 69 147 201} {} listbox8 {} {} ridge #000000 #ffffc8 2 n} {button button9 {18 264 39 282} {} 1 {} {} flat #000000 #d9d9d9 1 n} {button button10 {48 264 68 282} {} 2 {} {} flat #000000 #d9d9d9 1 n} {button button11 {78 264 234 282} {} {and other hidden buttons} {} {} flat #000000 #d9d9d9 1 n} {text txt {153 69 372 201} {} text12 {} {} sunken #000000 #d4ffff 1 n} {button button13 {150 210 369 243} {.full.txt tag configure bold -font {Helvetica 12 bold}\
|
||||
.full.txt tag configure italic -font {Helvetica 12 italic}\
|
||||
.full.txt tag configure large -font {Helvetica -14 bold}\
|
||||
.full.txt tag configure title -font {Helvetica 12 bold italic} -justify center\
|
||||
.full.txt tag configure link -font {Helvetica -12 underline} -foreground #000080\
|
||||
.full.txt tag configure code -font {Courier 13}\
|
||||
.full.txt tag configure warning -font {Helvetica 12 bold} -foreground #800000\
|
||||
\
|
||||
# That't the way help files are written\
|
||||
\
|
||||
.full.txt delete 1.0 end\
|
||||
.full.txt insert end {Centered title} {title} "\
|
||||
\
|
||||
You can make different " {} "portions of text bold" {bold} " or italic " {italic} ".\
|
||||
Some parts of them can be written as follows" {} "\
|
||||
SELECT * FROM PHONEBOOK" {code} "\
|
||||
You can also change " {} "colors for some words " {warning} "or underline them" {link} } {Old style button} {} {} raised #000000 #d9d9d9 2 n} {checkbox checkbox14 {48 297 153 309} {} different {} {} flat #00009c #d9d9d9 1 b} {checkbox checkbox15 {48 321 156 336} {} {fonts and} {} {} flat #cc0000 #d9d9d9 1 i} {checkbox checkbox16 {48 345 156 360} {} colors {} {} flat #00b600 #dfb2df 1 f} {radio radio17 {207 297 330 315} {} {red , rosu , rouge} color red flat #9c0000 #d9d9d9 1 n} {radio radio18 {207 321 324 333} {} {green , verde , vert} color green flat #009000 #d9d9d9 1 n} {radio radio19 {207 345 327 363} {} {blue , albastru, bleu} color blue flat #000000 #d9d9d9 1 n} {label selcolor {210 369 345 384} {} {} color {} flat #000000 #d9d9d9 1 n} {button button21 {285 258 363 285} {destroy .full} Exit {} {} raised #7c0000 #dfdbb8 1 b}
|
||||
Working with Tables namespace f3 13 {3 4 5 6 7 9 10 11 12 13} 377x263+59+127 {radio usa {36 24 138 36} {} USA selcont} {radio europe {36 45 141 60} {} Europe selcont} {radio africa {36 66 147 81} {} Africa selcont} {label label6 {9 99 339 114} {} {Select one of the above continents and press} {}} {button button7 {270 93 354 117} {Tables::open phonebook "continent='$selcont'" $selorder} {Show them} {}} {button button9 {66 189 312 213} {Tables::design phonebook} {Show me the phonebook table structure} {}} {button button10 {141 228 240 252} {destroy .f3} {Close the form} {}} {button button11 {93 141 282 165} {Tables::open phonebook "company=true"} {Show me only the companies} {}} {radio name {183 24 261 36} {} {Order by name} selorder} {radio phone_nr {183 45 267 57} {} {Order by phone number} selorder}
|
||||
The simplest form mf 5 {FS {set thename {}}} 306x136+82+146 {label label {42 45 99 60} {} Name {} label flat #000000 #d9d9d9 1 {Helvetica 12 bold italic}} {entry ename {120 42 219 63} {} entry2 thename ename sunken #000000 #fefefe 1 n} {button button3 {6 96 108 129} {set thename Teo} {Set the name} {} button3 raised #000000 #d9d9d9 1 n} {button button4 {192 96 300 129} {destroy .mf} {Close the form} {} button4 raised #000000 #d9d9d9 1 n} {button button5 {114 96 186 129} {set thename {}} {Clear it} {} button5 raised #000000 #d9d9d9 1 n}
|
||||
A simple demo form asdf 14 {FS {set color none}} 370x310+50+75 {label label1 {15 36 99 57} {} {Selected color} {} label1 flat #000000 #d9d9d9 1} {entry entry2 {111 36 225 54} {} entry2 color entry2 sunken #000000 #fefefe 1} {radio red {249 21 342 36} {} {Red as cherry} color red flat #900000 #d9d9d9 1} {radio green {249 45 342 60} {} {Green as a melon} color green flat #008800 #d9d9d9 1} {radio blue {249 69 342 84} {} {Blue as the sky} color blue flat #00008c #d9d9d9 1} {button button6 {45 69 198 99} {set color spooky} {Set a weird color} {} button6 ridge #0000b0 #dfbcdf 2} {label label7 {24 129 149 145} {} {The checkbox's value} {} label7 flat #000000 #d9d9d9 1} {entry entry8 {162 127 172 145} {} entry8 cbvalue entry8 sunken #000000 #fefefe 1} {checkbox checkbox9 {180 126 279 150} {} {Check me :-)} cbvalue checkbox9 flat #000000 #d9d9d9 1} {button button10 {219 273 366 303} {destroy .asdf} {Close that simple form} {} button10 raised #000000 #d9d9d9 1} {button button11 {219 237 366 267} {Forms::open "Phone book"} {Open my phone book} {} button11 raised #000000 #d9d9d9 1} {listbox lb {12 192 162 267} {} listbox12 {} lb sunken #000000 #fefefe 1} {button button13 {12 156 162 186} {.asdf.lb insert end red green blue cyan white navy black purple maroon violet} {Add some information} {} button13 raised #000000 #d9d9d9 1} {button button14 {12 273 162 303} {.asdf.lb delete 0 end} {Clear this listbox} {} button14 raised #000000 #d9d9d9 1}
|
||||
Working with listboxes f2 5 {FS {set thestudent ""}} 257x263+139+147 {listbox lb {6 6 246 186} {} listbox1 {} lb sunken #000000 #ffffd4 1} {button button2 {9 234 124 258} {# Populate the listbox with some data\
|
||||
#\
|
||||
\
|
||||
foreach student {John Bill Doe Gigi} {\
|
||||
\ .f2.lb insert end $student\
|
||||
}\
|
||||
\
|
||||
\
|
||||
\
|
||||
# Binding the event left button release to the\
|
||||
# list box\
|
||||
\
|
||||
bind .f2.lb <ButtonRelease-1> {\
|
||||
\ set idsel [.f2.lb curselection]\
|
||||
\ if {$idsel!=""} {\
|
||||
\ \ set thestudent [.f2.lb get $idsel]\
|
||||
\ }\
|
||||
}\
|
||||
\
|
||||
# Cleaning the variable thestudent\
|
||||
\
|
||||
set thestudent {}} {Show students} {} button2 groove #000000 #d9d9d9 2} {button button3 {132 234 247 258} {destroy .f2} {Close the form} {} button3 groove #000000 #d9d9d9 1} {label label4 {9 213 119 228} {} {You have selected} {} label4 flat #000000 #d9d9d9 1} {label label5 {129 213 219 228} {} {} thestudent label5 flat #00009a #d9d9d9 1}
|
||||
Invoices inv 0 {FS {frame .inv.f\
|
||||
place .inv.f -x 5 -y 100 -width 500 -height 300\
|
||||
set wn [Tables::getNewWindowName]\
|
||||
Tables::createWindow .inv.f\
|
||||
set PgAcVar(mw,.inv.f,updatable) 0\
|
||||
set PgAcVar(mw,.inv.f,layout_found) 0\
|
||||
set PgAcVar(mw,.inv.f,layout_name) ""\
|
||||
Tables::selectRecords .inv.f "select * from cities"\
|
||||
}} 631x439+87+84
|
||||
\.
|
||||
COPY "pga_scripts" FROM stdin;
|
||||
How are forms keeped inside ? Tables::open pga_forms\
|
||||
\
|
||||
\
|
||||
\
|
||||
|
||||
Opening a table with filters Tables::open phonebook "name ~* 'e'" "name desc"\
|
||||
\
|
||||
\
|
||||
|
||||
Autoexec Mainlib::tab_click Forms\
|
||||
Forms::open {Full featured form}\
|
||||
\
|
||||
\
|
||||
|
||||
\.
|
||||
COPY "pga_reports" FROM stdin;
|
||||
My phone book phonebook set PgAcVar(report,tablename) "phonebook" ; set PgAcVar(report,y_rpthdr) 21 ; set PgAcVar(report,y_pghdr) 47 ; set PgAcVar(report,y_detail) 66 ; set PgAcVar(report,y_pgfoo) 96 ; set PgAcVar(report,y_rptfoo) 126 ; .pgaw:ReportBuilder.c create text 10 35 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {name} -tags {t_l mov ro} ; .pgaw:ReportBuilder.c create text 10 52 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {name} -tags {f-name t_f rg_detail mov ro} ; .pgaw:ReportBuilder.c create text 141 36 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {city} -tags {t_l mov ro} ; .pgaw:ReportBuilder.c create text 141 51 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {city} -tags {f-city t_f rg_detail mov ro} ; .pgaw:ReportBuilder.c create text 231 35 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {phone_nr} -tags {t_l mov ro} ; .pgaw:ReportBuilder.c create text 231 51 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {phone_nr} -tags {f-phone_nr t_f rg_detail mov ro} \N \N
|
||||
\.
|
||||
COPY "phonebook" FROM stdin;
|
||||
FIAT 623463445 t europe
|
||||
Gelu Voican 01-32234 Bucuresti f europe
|
||||
Radu Vasile 01-5523423 Bucuresti f europe
|
||||
MUGADUMBU SRL +92 534662634 Cairo t africa
|
||||
Jimmy Page 66323452 f europe
|
||||
IBM 623346234 \N t usa
|
||||
John Doe +44 35 2993825 Washington f usa
|
||||
Bill Clinton +44 35 9283845 New York f usa
|
||||
Monica Levintchi +44 38 5234526 Dallas f usa
|
||||
Bill Gates +42 64 4523454 Los Angeles f usa
|
||||
COMPAQ 623462345 \N t usa
|
||||
SUN 784563253 \N t usa
|
||||
DIGITAL 922644516 \N t usa
|
||||
Frank Zappa 6734567 Montreal f usa
|
||||
Constantin Teodorescu +40 39 611820 Braila f europe
|
||||
Ngbendu Wazabanga 34577345 f africa
|
||||
Mugabe Kandalam 7635745 f africa
|
||||
Vasile Lupu 52345623 Bucuresti f europe
|
||||
Gica Farafrica +42 64 4523454 Los Angeles f usa
|
||||
Victor Ciorbea 634567 Bucuresti f europe
|
||||
\.
|
||||
COPY "pga_layout" FROM stdin;
|
||||
pga_forms 2 formname formsource 82 713
|
||||
Usaisti 5 name phone_nr city company continent 150 150 150 150 150
|
||||
q1 5 name phone_nr city company continent 150 150 150 150 150
|
||||
view_saved_from_that_query 5 name phone_nr city company continent 150 150 150 150 150
|
||||
phonebook 5 name phone_nr city company continent 150 105 80 66 104
|
||||
Query that can be saved as view 5 name phone_nr city company continent 150 150 150 150 150
|
||||
pg_database 4 datname datdba encoding datpath 150 150 150 150
|
||||
pg_language 5 lanname lanispl lanpltrusted lanplcallfoid lancompiler 150 150 150 150 150
|
||||
cities 3 id name prefix 60 150 150
|
||||
3 id name prefix 125 150 150
|
||||
3 id name prefix 150 150 150
|
||||
3 id name prefix 150 150 150
|
||||
3 id name prefix 150 150 150
|
||||
\.
|
||||
COPY "pga_schema" FROM stdin;
|
||||
Simple schema cities 10 10 phonebook 201.0 84.0 {cities name phonebook city}
|
||||
\.
|
||||
COPY "cities" FROM stdin;
|
||||
3 Braila 4039
|
||||
4 Galati 4036
|
||||
5 Dallas 5362
|
||||
6 Cairo 9352
|
||||
1 Bucuresti 4013
|
||||
7 Montreal 5325
|
||||
\.
|
||||
CREATE UNIQUE INDEX "cities_id_key" on "cities" using btree ( "id" "int4_ops" );
|
BIN
src/bin/pgaccess/doc/html/tutorial/addref.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
src/bin/pgaccess/doc/html/tutorial/altern_q.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
src/bin/pgaccess/doc/html/tutorial/altern_v.jpg
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
src/bin/pgaccess/doc/html/tutorial/copyright.html
Normal file
33
src/bin/pgaccess/doc/html/tutorial/index.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html><head><title>PgAccess - a Tcl/Tk interface for PostgreSQL</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess - a Tcl/Tk interface for PostgreSQL</h1>
|
||||
<hr>
|
||||
<a name="intro">
|
||||
<ul><li><a href="intro.html">Introduction</a>
|
||||
<ul><li><a href="intro.html#whatpga">What is PgAccess?</a>
|
||||
<li><a href="intro.html#helppga">How to get help with PgAccess</a>
|
||||
</ul>
|
||||
<a name="start">
|
||||
<li><a href="start.html">Getting Started</a>
|
||||
<ul><li><a href="start.html#getpga">How to get PgAccess</a>
|
||||
<li><a href="start.html#uncpga">How to uncompress PgAccess</a>
|
||||
<li><a href="start.html#putpga">Putting PgAccess where it will be found</a>
|
||||
<li><a href="start.html#startpga">Starting PgAccess</a>
|
||||
<li><a href="irix.html">Installing PgAccess under IRIX 5.3</a>
|
||||
</ul>
|
||||
<a name="problems">
|
||||
<li><a href="problems.html">Common Initial Problems</a>
|
||||
<ul><li><a href="problems.html#connfail">Connection failure</a>
|
||||
<li><a href="problems.html#nonuser">User not defined</a>
|
||||
<li><a href="problems.html#libpg">libpgtcl not found</a>
|
||||
<li><a href="problems.html#spchar">Locale specific characters</a>
|
||||
<li><a href="problems.html#pg63">Problems with PostgreSQL 6.3.x</a>
|
||||
</ul>
|
||||
<li><a href="tut.html">PgAccess tutorial</a>
|
||||
<ul><li><a href="tut_user.html">User Administration</a>
|
||||
<li><a href="tut_new.html">Creating a table</a>
|
||||
<li><a href="tut_edit.html">Editing a table</a>
|
||||
<li><a href="tut_sel1.html">Querying - SELECT</a>
|
||||
</ul>
|
||||
</body></html>
|
39
src/bin/pgaccess/doc/html/tutorial/intro.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<html><head><title>PgAccess - Introduction</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess - Introduction</h1>
|
||||
<a name="whatpga"><h2>What is PgAccess?</h2>
|
||||
PgAccess is a graphical user interface for the PostgreSQL database management
|
||||
system written in the Tcl/Tk scripting language by Constantin Teodorescu. It
|
||||
allows the user to interact with PostgreSQL in a manner similar to many PC
|
||||
database applications, with menu choices and graphical tools like buttons.
|
||||
This means that the user can avoid the basic command line interface for most
|
||||
common tasks. PgAccess doesn't change the way PostgreSQL operates, just makes
|
||||
it easier to use for those familiar with graphical interfaces.<p>
|
||||
Obviously, you <u>must</u> have PostgreSQL installed and running, and Tcl/Tk on
|
||||
your system before you can use PgAccess.<p>
|
||||
PgAccess is an "open source" application. The source code is available to the
|
||||
user, and may be modified by the user. The user can fix a bug, or change the
|
||||
way a function operates. You may not want to get that involved with the
|
||||
programming, but you have the option to do so. If you feel you have made an
|
||||
improvement to the program, you are encouraged to share it with other users.<p>
|
||||
If you are not familiar with how open source software can be altered and
|
||||
redistributed, please read <a href="copyright.html">this</a>.<p>
|
||||
<a name="helppga"><h2>How to get help with PgAccess</h2>
|
||||
The mailing list for PgAccess is: <b>pgsql-interfaces@postgresql.org</b><p>
|
||||
If you have any questions regarding PgAccess you should subscribe to this
|
||||
list in the following way:<p>
|
||||
First subscribe to the list by sending an email message to:<p>
|
||||
<samp>pgsql-interfaces-request@postgresql.org</samp><p>
|
||||
Send a single line in the body of the message as follows:<p>
|
||||
<samp>subscribe</samp><p>
|
||||
In a short time you should receive a message beginning like this:<p>
|
||||
<samp>Welcome to the pgsql-interfaces mailing list!<br>
|
||||
...</samp><p>
|
||||
This will contain instructions on how to remove yourself from the mailing
|
||||
list, so save that message. You may only want to ask a few questions and then
|
||||
stop receiving messages.<p>
|
||||
You may also email <a href="mailto:teo@flex.ro">Constantin Teodorescu</a>
|
||||
directly, although writing to a mailing list with many correspondents will often
|
||||
produce a quicker answer.<p>
|
||||
<a href="index.html#intro">Back to index</a>
|
||||
</body></html>
|
@@ -128,6 +128,6 @@ them. Let common sense prevail!</P>
|
||||
|
||||
<P>Stuart Rison LICR University College London London W1P 8BT<BR>
|
||||
<A HREF="mailto:stuart@ludwig.ucl.ac.uk">stuart@ludwig.ucl.ac.uk</A></P>
|
||||
|
||||
<a href="index.html#start">Back to index</a>
|
||||
</BODY>
|
||||
</HTML>
|
1
src/bin/pgaccess/doc/html/tutorial/newref.txt
Normal file
@@ -0,0 +1 @@
|
||||
Cassileth, BR~Unorthodox Cancer Medicine~Cancer Investigation~~1986~4~6~591-598
|
BIN
src/bin/pgaccess/doc/html/tutorial/newtable.jpg
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
src/bin/pgaccess/doc/html/tutorial/newtable.tga
Normal file
83
src/bin/pgaccess/doc/html/tutorial/problems.html
Normal file
@@ -0,0 +1,83 @@
|
||||
<html><head><title>PgAccess - Common Problems</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>Common Problems with PgAccess</h1>
|
||||
<a name="connfail"><h2>Connection failure</h2>
|
||||
One of the most common initial problems is the message:<p>
|
||||
<samp>Error connecting database<br>
|
||||
Connection to database failed<br>
|
||||
connectDB() failed: Is the<br>
|
||||
postmaster running and<br>
|
||||
accepting TCP/IP (with -i)<br>
|
||||
connections at 'localhost' on<br>
|
||||
port '5432'?</samp><p>
|
||||
This usually occurs because the "postmaster" (the postgreSQL backend) was not
|
||||
started with the <samp>-i</samp> option. Usually just adding <samp>-i</samp> to
|
||||
the command line that starts the postmaster and restarting will fix this.<p>
|
||||
If you have installed the prewritten script to start <b>postgreSQL</b>
|
||||
automatically, this option is (currently) commented out:<p>
|
||||
<samp># PGOPTS="-i"</samp><p>
|
||||
just remove the hash and space and comment out the "blank" option above:<p>
|
||||
<samp>PGOPTS=""</samp><p>
|
||||
<a name="nonuser"><h2>User not defined</h2>
|
||||
Initially, <b>postgreSQL</b> only has one user, <samp>postgres</samp>, and any
|
||||
other user who starts up PgAccess will get the message:<p>
|
||||
<samp>Error connecting database<br>
|
||||
Connection to database failed<br>
|
||||
FATAL 1: SetUserId: user<br>
|
||||
'jim' is not in 'pg_shadow'</samp><p>
|
||||
See <b>User Administration</b> in the <b>PgAccess tutorial</b> for a description
|
||||
of how to create users.<p>
|
||||
<a name="libpg"><h2>libpgtcl not found</h2>
|
||||
PgAccess requires a library of functions named <samp>libpgtcl</samp>. This
|
||||
should be available with the postgreSQL distribution, and is usually placed in
|
||||
the correct location when installing postgreSQL. First check that there is a
|
||||
file named <samp>libpgtcl.so</samp> (perhaps with a number appended - or
|
||||
<samp>libpgtcl.dll</samp> on Windows systems) on your
|
||||
system. If not, you will have to download and perhaps compile this library.<p>
|
||||
<samp>ftp://ftp.flex.ro/pub/pgaccess</samp><p>
|
||||
is one place that you can download precompiled libpgtcl libraries for
|
||||
PgAccess.<p>
|
||||
<a name="spchar">
|
||||
<h2>Locale specific characters</h2>
|
||||
This problem occurs with some special characters used in different
|
||||
countries because PgAccess did not use fonts with `-ISO8859-1' encoding.<p>
|
||||
One solution was proposed by H.P.Heidinger ( hph@hphbbs.ruhr.de) and
|
||||
is very simple.<p>
|
||||
If you look in the file pgaccess.tcl, you will find the fonts declared in
|
||||
this manner:<p>
|
||||
<TT>$ grep -e '-font' -i pgaccess.tcl<BR>
|
||||
-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \<br>
|
||||
...</TT></P>
|
||||
The font declarations should be altered to:<p>
|
||||
<tt>-font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-iso8859-1<br>
|
||||
...</tt><p>
|
||||
That is, inserting an asterisk between the first pair of hyphens, and changing
|
||||
the final two asterisks to <samp>iso8859</samp> and <samp>1</samp>
|
||||
respectively.<p>
|
||||
You can alter the source code by running the following script :
|
||||
<P><TT>#!/bin/sh<BR>
|
||||
cp pgaccess.tcl pgaccess.tcl-org<BR>
|
||||
cat pgaccess.tcl |\<BR>
|
||||
sed -e's/\-\*\-\*\ /\-iso8859\-1\ /g' |\<BR>
|
||||
sed -e's/\-\*\-\*\}/\-iso8859\-1}/g' |\<BR>
|
||||
sed -e's/\-\*\-\*\]/\-iso8859\-1]/g' |\<BR>
|
||||
sed -e's/\-\*\-\*$/\-iso8859\-1/g' |\<BR>
|
||||
sed -e's/\-Clean\-/\-Fixed\-/g' |\<BR>
|
||||
sed -e's/clean/fixed/g' >pgaccess.iso<BR>
|
||||
mv pgaccess.iso pgaccess.tcl<BR>
|
||||
chmod +x pgaccess.tcl</TT><P>
|
||||
The final version of PgAccess (1.0) will let the user decide what fonts
|
||||
will be used through a "preferences" dialog window.</p>
|
||||
<a name="pg63">
|
||||
<h2>Problem with PostgreSQL 6.3.x</h2>
|
||||
PgAccess 0.93 and later may have problems working with PostgreSQL 6.3.x.
|
||||
Changes in libpgtcl have been made to remove these, but if you are
|
||||
using PostgreSQL 6.3.x, this patch will allow you to get around the problems.<p>
|
||||
In the procedure <tt>wpg_exec</tt> change the following line:<p>
|
||||
<tt>set pgsql(errmsg) [pg_result $pgsql(res) -error]</tt><p>
|
||||
to this:<p>
|
||||
<tt>set pgsql(errmsg) "NO ERROR INFORMATION SUPPLIED"</tt><p>
|
||||
and the program will work. The only disadvantage is that with some error
|
||||
conditions, you will not get the appropriate error message from libpgtcl.<p>
|
||||
<a href="index.html#problems">Back to index</a>
|
||||
</body></html>
|
BIN
src/bin/pgaccess/doc/html/tutorial/screen1.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
src/bin/pgaccess/doc/html/tutorial/sel_tbl.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
74
src/bin/pgaccess/doc/html/tutorial/start.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<html><head><title>PgAccess - Getting Started</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess - Getting Started</h1>
|
||||
<a name="getpga"><h2>How to get PgAccess</h2>
|
||||
If you have this HTML help system, you have probably already downloaded
|
||||
PgAccess. If not, or you wish to download the latest version, it is available
|
||||
from the URL:<p>
|
||||
<samp>http://www.flex.ro</samp><p>
|
||||
The home page will contain instructions on which files to download for your
|
||||
operating system. Download the file to a directory where the program will
|
||||
eventually reside (see below).<p>
|
||||
<a name="uncpga"><h2>How to uncompress PgAccess</h2>
|
||||
PgAccess, like most applications available for download, is usually downloaded
|
||||
in compressed format to save download time. You must uncompress these files in
|
||||
order to use the application.<p>
|
||||
<h3>UNIX (Linux, BSD, IRIX, Solaris, etc.)</h3>
|
||||
The files will be compressed using "gzip" and packaged using "tar", and have
|
||||
filenames like this:<p>
|
||||
<samp>pgaccess-n.nn.tar.gz</samp><p>
|
||||
Note that "n.nn" will be the version number in an actual file.<p>
|
||||
First decide where you want to have the program. A typical location on UNIX
|
||||
systems is <samp>/usr/local/src/<name></samp>, where <name> is the name of
|
||||
the program. To use this location, download or move the "tar.gz" file to the
|
||||
directory <samp>/usr/local/src</samp>. Change to that directory, and
|
||||
uncompress the file with the command:<p>
|
||||
<samp>tar -zxvf pgaccess-n.nn.tar.gz</samp><p>
|
||||
You should see the files listed as they are uncompressed and placed in the new
|
||||
directory, and now have a directory named:<p>
|
||||
<samp>/usr/local/src/pgaccess</samp><p>
|
||||
In that directory will be all of the files that were packaged in the downloaded
|
||||
file. When you have PgAccess working, you can delete the file with the ".tar"
|
||||
or ".tar.gz" extension.
|
||||
<h3>Windows</h3>
|
||||
The files will be compressed so that "WinZip" will uncompress the package. Just
|
||||
open the file with "WinZip" and the program files will be extracted.<p>
|
||||
<a name="putpga"><h2>Putting PgAccess where it will be found</h2>
|
||||
<h3>UNIX</h3>
|
||||
In order to run PgAccess easily, the program file "pgaccess.tcl" should be in a
|
||||
location on the "PATH" of the system. You can find out what the PATH is by
|
||||
entering:<p>
|
||||
<samp>echo $PATH<br>
|
||||
/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:./:/usr/local/pgsql/bin
|
||||
</samp><p>
|
||||
Usually the directory <samp>/usr/local/bin</samp> will be in your PATH, and that
|
||||
is a fairly common place to put programs like PgAccess. Other common
|
||||
directories in the PATH are <samp>/usr/bin</samp> and <samp>/usr/sbin</samp>.
|
||||
Simply move the file "pgaccess.tcl" to the directory where you want it.<p>
|
||||
<h3>Windows</h3>
|
||||
You will usually link PgAccess to an icon, so just specify the full path to the
|
||||
program when you create the icon.
|
||||
<a name=startpga"><h2>Starting PgAccess</h2>
|
||||
The easiest way to start PgAccess is to simply invoke the program by name:<p>
|
||||
<samp>pgaccess.tcl</samp><p>
|
||||
If the program has been placed in a directory listed in the PATH, the PgAccess
|
||||
window should appear.<p>
|
||||
<h3>Starting from a menu</h3>
|
||||
Most users will want to link the program to a menu or icon so that it can be
|
||||
started using the mouse or other pointing device. Here is a method that will
|
||||
work on most Linux X-Windows systems. Create a file named "pgaccess" in the directory
|
||||
<samp>/etc/X11/wmconfig</samp> with the following contents:<p>
|
||||
<samp>pgaccess name "PgAccess"<br>
|
||||
pgaccess description "postgreSQL frontend"<br>
|
||||
pgaccess mini-icon "mini-pgaccess.xpm"<br>
|
||||
pgaccess group "Applications"<br>
|
||||
pgaccess exec "pgaccess.tcl &"</samp><p>
|
||||
This assumes that you have an "Applications" sub-menu. You may prefer
|
||||
"Programs" or some other place. Also, you will have to create the
|
||||
"mini-pgaccess.xpm" icon if you want it to appear. You can edit an existing
|
||||
icon from the <samp>/usr/share/icons/mini</samp> directory in XPaint and rename
|
||||
it. When you next start an X-Windows session, there should be a "PgAccess" item
|
||||
on the menu that you have chosen. Clicking on this item should start
|
||||
PgAccess.<p>
|
||||
<a href="index.html#start">Back to index</a>
|
||||
</body></html>
|
50
src/bin/pgaccess/doc/html/tutorial/tut.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<html><head><title>PgAccess - Tutorial</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess - Tutorial</h1>
|
||||
<a name="admin"><h2>User Administration</h2>
|
||||
The procedure for setting up <b>postgreSQL</b> usually results in a single user
|
||||
named <samp>postgres</samp>. In order for anyone else to use <b>postgreSQL</b>,
|
||||
users must be added. The program <samp>createuser</samp> accomplishes this.
|
||||
First become the PostgreSQL administrator (usually <samp>postgres</samp>):<p>
|
||||
<samp>su postgres</samp><p>
|
||||
Then create a new user:<p>
|
||||
<samp>createuser jim<br>
|
||||
Enter user's postgres ID or RETURN to use unix user ID: 500 -><br>
|
||||
Is user "jim" allowed to create databases (y/n) y<br>
|
||||
Is user "jim" a superuser? (y/n) n<br>
|
||||
createuser: jim was successfully added</samp><p>
|
||||
You can use either the UNIX user ID or the postgres ID to identify users. See
|
||||
the <b>postgreSQL</b> documentation in the "admin" section for a fuller
|
||||
account of users and groups.<p>
|
||||
To remove users, use the <samp>destroyuser</samp> command in the same way.<p>
|
||||
<img src="screen1.jpg" border=1 align=right>
|
||||
<a name="basic"><h2>Basic use of PgAccess</h2>
|
||||
<h3>Creating a database</h3>
|
||||
At the right is the window you should see when PgAccess starts up. The first
|
||||
task for most users will be to create a database.<p>
|
||||
Press the <em>New</em> button to bring up the window shown below. This will
|
||||
allow you to specify the structure of the new table. It is important to note
|
||||
that if you haven't specified a database when starting up PgAccess, this table
|
||||
will be created in the database named <samp><username></samp>, your
|
||||
username.<p>
|
||||
Assume that you want to create a table with entries describing bibliographic
|
||||
references in the field of chemistry. Choose a table name, such as
|
||||
<samp>chemref</samp> that will be easy to recall and find in a list. Enter the
|
||||
table name in the first input field.<p>
|
||||
When you already have tables in a database, you can use the <em>Inherits</em>
|
||||
button to toggle a list of existing tables to inherit characteristics of another
|
||||
table. In this example, there should be no previous tables to use.<p>
|
||||
Enter each field, giving it a name, field type and size, if the field type does
|
||||
not imply the size. That is, if your first field was to be a sequence number,
|
||||
and you selected <em>int2</em> as the field type, you would not have to specify
|
||||
a field size. However, if your second field was to contain the author of the
|
||||
reference, and was a <em>varchar</em> type, you would have to specify how many
|
||||
characters would be allowed in the field.<p>
|
||||
As you enter each field, click the <em>Add field</em> button to add it to the
|
||||
list at the right side of the window. You can change the position of fields
|
||||
using the <em>Move field up</em> and <em>Move field down</em> buttons, or delete
|
||||
a field if you decide it isn't what you wanted. When you are finished
|
||||
specifying fields, press the <em>Create table</em> button.<p>
|
||||
<img src="newtable.jpg" border=1 align=right>
|
||||
<a href="index.html#tut">Back to index</a>
|
||||
</body></html>
|
39
src/bin/pgaccess/doc/html/tutorial/tut_edit.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<html><head><title>PgAccess Tutorial</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess Tutorial - Editing a table</h1>
|
||||
<img src="sel_tbl.jpg" border=1 align=right>
|
||||
<h2>Adding records</h2>
|
||||
Once you have a table, you can begin to add entries to it. In the main
|
||||
PgAccess window, when you click the <em>Tables</em> button, you should see the
|
||||
new table appear in the list of tables. Highlighting the table name by clicking
|
||||
on it and clicking on the <em>Open</em> button will open that table in another
|
||||
window, as shown below.<p>
|
||||
The most straighforward way to add records to a table is to type the information
|
||||
directly into the fields. Two records have been entered in the table shown. As
|
||||
is common with this user interface, clicking the mouse while the pointer is in a
|
||||
field will allow keyboard entry to that field. This type of entry is adequate
|
||||
when the information arrives infrequently in small parcels, for instance in
|
||||
keeping a table of contact information about other researchers. However, what
|
||||
do you do when someone emails you the entire reference list for their doctoral
|
||||
dissertation?<p>
|
||||
This is best handled using the SQL <em>COPY</em> command.
|
||||
First, the information will have to be massaged into shape in what is called a
|
||||
'flat' ASCII file. This is simply a text file in which each line is a record,
|
||||
and each field in each record is separated by a <em>delimiter</em> such as a
|
||||
tilde (~). The fields will have to be in the same order as those in your table,
|
||||
and there will have to be the same number of fields in each record as are in the
|
||||
table, otherwise you may get unexpected data or no data at all. Say you produce
|
||||
a text file named <samp>newref.txt</samp> that starts like this:<p>
|
||||
<samp>Cassileth, BR~Unorthodox Cancer Medicine~Cancer Investigation~~1986~4~6~591-598
|
||||
<br>...</samp><p>
|
||||
Notice that there are two consecutive tildes to allow for the fact that this
|
||||
particular entry doesn't have anything in the <b>Editor</b> field.
|
||||
You can then perform a <em>Query</em> as follows:<p>
|
||||
<samp>COPY psyref FROM '/home/jim/newref.txt' USING DELIMITERS
|
||||
'~';</samp><p>
|
||||
This will read the records from <samp>newref.txt</samp> and insert them into the
|
||||
table <samp>psyref</samp>. See the PostgreSQL documentation under the headings
|
||||
<br><b>Tutorial|The Query Language|Populating a Class with Instances</b><p>
|
||||
<img src="addref.jpg" border=1 align=right>
|
||||
<a href="index.html#tut">Back to index</a>
|
||||
</body></html>
|
36
src/bin/pgaccess/doc/html/tutorial/tut_new.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<html><head><title>PgAccess Tutorial</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess Tutorial - Creating a table</h1>
|
||||
<img src="screen1.jpg" border=1 align=right>
|
||||
<h2>Creating a table</h2>
|
||||
At the right is the window you should see when PgAccess starts up. The first
|
||||
task for most users will be to create a database. Notice the 'buttons' at the
|
||||
left of the main window. Clicking on these allows you to see the names of
|
||||
different <em>objects</em> that are stored in your database, which should be
|
||||
empty at the moment.<p>
|
||||
Click the <em>Tables</em> and <em>New</em> buttons to bring up the window shown
|
||||
below. This will allow you to specify the structure of the new table. It is
|
||||
important to note that if you haven't specified a database when starting up
|
||||
PgAccess, this table will be created in the database named
|
||||
<samp><username></samp>, your username.<p>
|
||||
Assume that you want to create a table with entries describing bibliographic
|
||||
references in the field of psychology. Choose a table name, such as
|
||||
<samp>psyref</samp> that will be easy to recall and find in a list. Enter the
|
||||
table name in the first input field.<p>
|
||||
When you already have tables in a database, you can use the <em>Inherits</em>
|
||||
button to toggle a list of existing tables to inherit characteristics of another
|
||||
table. In this example, there should be no previous tables to use.<p>
|
||||
Enter each field, giving it a name, field type and size, if the field type does
|
||||
not imply the size. That is, if your first field was to be a sequence number,
|
||||
and you selected <em>int2</em> as the field type, you would not have to specify
|
||||
a field size. However, if your second field was to contain the author of the
|
||||
reference, and was a <em>varchar</em> type, you would have to specify how many
|
||||
characters would be allowed in the field.<p>
|
||||
As you enter each field, click the <em>Add field</em> button to add it to the
|
||||
list at the right side of the window. You can change the position of fields
|
||||
using the <em>Move field up</em> and <em>Move field down</em> buttons, or delete
|
||||
a field if you decide it isn't what you wanted. When you are finished
|
||||
specifying fields, press the <em>Create table</em> button.<p>
|
||||
<img src="newtable.jpg" border=1 align=right>
|
||||
<a href="index.html#tut">Back to index</a>
|
||||
</body></html>
|
36
src/bin/pgaccess/doc/html/tutorial/tut_sel1.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<html><head><title>PgAccess Tutorial</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess Tutorial - SELECT</h1>
|
||||
<img src="altern_q.jpg" border=1 align=right>
|
||||
<h2>What is a query?</h2>
|
||||
<em>Query</em> is the term for an SQL command which will perform an operation
|
||||
on a table. It is sometimes confusing to newcomers, as some of the operations
|
||||
seem to have nothing to do with querying in the common sense of <em>asking</em>.
|
||||
As we saw in the previous section, a <em>query</em> can simply copy
|
||||
records from an ASCII file to a table.<p>
|
||||
The PostgreSQL documentation has a complete list of <em>queries</em> that can be
|
||||
used. We'll start with the common task of selecting records with certain
|
||||
characteristics.<p>
|
||||
<h2>Selecting records</h2>
|
||||
<img src="altern_v.jpg" border=1 align=right>
|
||||
Suppose that I want to know all of the references in the sample table
|
||||
<em>psyref</em> for which the word "alternative" appeared in the title.<p>
|
||||
By clicking <em>Query</em>, then <em>New</em>, a <b>Query builder</b> window will
|
||||
appear. Clicking in the area below the buttons will allow the user to enter an
|
||||
SQL <em>query</em>. The specification of the <em>query</em> must be exact or
|
||||
PostgreSQL will return an error message.<p>
|
||||
The <em>query</em> shown will <b>SELECT</b> those records from <em>psyref</em>
|
||||
that contain the word "alternative" anywhere in the <em>title</em> field. The
|
||||
'*' indicates that all of the fields are to be returned. You might only want to
|
||||
return, for instance, the <em>author</em> field if you were only interested in
|
||||
which authors had used that word in the title of their work.<p>
|
||||
At the right is the record that fulfils these conditions, displayed in the
|
||||
<b>Table viewer</b>. If you wanted to save this query for use again,
|
||||
clicking the <em>Save query definition</em> button will do so. You will then
|
||||
see <em>altern</em> listed under <em>Queries</em> when you return to the main
|
||||
window. By clicking the <em>Save this query as a view</em> tickbox in the
|
||||
<b>Query builder</b>, the result of your query will be saved as a
|
||||
<em>View</em> which you can access from <em>Views</em> in the main window.
|
||||
Click the <em>Close</em> button to leave the <b>Query builder</b>.<p>
|
||||
<a href="index.html#tut">Back to index</a>
|
||||
</body></html>
|
28
src/bin/pgaccess/doc/html/tutorial/tut_user.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<html><head><title>PgAccess Tutorial</title></head>
|
||||
<body bgcolor="#C0C0C0">
|
||||
<h1>PgAccess Tutorial - User Administration</h1>
|
||||
While user administration is really not a part of the PgAccess program, it is
|
||||
such a basic operation that a brief description is given here.
|
||||
<h2>Creating users</h2>
|
||||
The procedure for setting up <b>postgreSQL</b> usually results in a single user
|
||||
named <samp>postgres</samp>. In order for anyone else to use <b>postgreSQL</b>,
|
||||
users must be added. The program <samp>createuser</samp> accomplishes this.
|
||||
First become the PostgreSQL administrator (usually <samp>postgres</samp>):<p>
|
||||
<samp>su postgres</samp><p>
|
||||
Then create a new user:<p>
|
||||
<samp>createuser jim<br>
|
||||
Enter user's postgres ID or RETURN to use unix user ID: 500 -><br>
|
||||
Is user "jim" allowed to create databases (y/n) y<br>
|
||||
Is user "jim" a superuser? (y/n) y<br>
|
||||
createuser: jim was successfully added</samp><p>
|
||||
You can use either the UNIX user ID or the postgres ID to identify users. See
|
||||
the <b>postgreSQL</b> documentation in the "admin" section for a fuller
|
||||
account of users and groups.<p>
|
||||
The reason for using the command line to create the first user (other than
|
||||
<em>postgres</em>) is that <em>postgres</em> may not have X-Window permission.
|
||||
You can also create users using <b>PgAccess</b> if you are created as a
|
||||
<em>superuser</em> as shown in the example above.<p>
|
||||
<h2>Removing users</h2>
|
||||
To remove users, use the <samp>destroyuser</samp> command in the same way.<p>
|
||||
<a href="index.html#tut">Back to index</a>
|
||||
</body></html>
|
@@ -1,90 +0,0 @@
|
||||
CREATE TABLE "pga_queries" ("queryname" varchar(64), "querytype" char(1), "querycommand" "text");
|
||||
CREATE TABLE "pga_forms" ("formname" varchar(64), "formsource" "text");
|
||||
CREATE TABLE "pga_scripts" ("scriptname" varchar(64), "scriptsource" "text");
|
||||
CREATE TABLE "pga_reports" ("reportname" varchar(64), "reportsource" "text", "reportbody" "text", "reportprocs" "text", "reportoptions" "text");
|
||||
CREATE TABLE "phonebook" ("name" varchar(32), "phone_nr" varchar(16), "city" varchar(32), "company" "bool", "continent" char(16));
|
||||
CREATE TABLE "pga_layout" ("tablename" varchar(64), "nrcols" "int2", "colnames" "text", "colwidth" "text");
|
||||
COPY "pga_queries" FROM stdin;
|
||||
Query that can be saved as view S select * from phonebook where continent='usa'
|
||||
\.
|
||||
COPY "pga_forms" FROM stdin;
|
||||
A simple demo form asdf 14 {1 2 3 4 5 6 7 8 9 10 11 12 13 14} 377x315+170+155 {label label1 {15 36 99 57} {} {Selected color} {}} {entry entry2 {111 36 225 54} {} entry2 color} {radio red {249 21 342 36} {} {Red as cherry} color} {radio green {249 45 342 60} {} {Green as a melon} color} {radio blue {249 69 342 84} {} {Blue as the sky} color} {button button6 {45 69 198 99} {set color spooky} {Set a weird color} {}} {label label7 {24 129 138 147} {} {The checkbox's value} {}} {entry entry8 {162 129 172 147} {} entry8 cbvalue} {checkbox checkbox9 {180 126 279 150} {} {Check me :-)} cbvalue} {button button10 {219 273 366 303} {destroy .asdf} {Close that simple form} {}} {button button11 {219 237 366 267} {open_form "Phone book"} {Open my phone book} {}} {listbox lb {12 192 162 267} {} listbox12 {}} {button button13 {12 156 162 186} {.asdf.lb insert end red green blue cyan white navy black purple maroon violet} {Add some information} {}} {button button14 {12 273 162 303} {.asdf.lb delete 0 end} {Clear this listbox} {}}
|
||||
Phone book pb 26 {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26} 444x310+284+246 {label label1 {33 12 63 30} {} Name {}} {entry name_entry {87 9 217 30} {} entry2 pbqs(name)} {label label3 {33 39 73 54} {} Phone {}} {entry entry4 {87 36 195 57} {} entry4 pbqs(phone_nr)} {label label5 {33 66 78 84} {} City {}} {entry entry6 {87 63 195 84} {} entry6 pbqs(city)} {query qs {3 6 33 33} {} query7 {}} {button button8 {126 177 198 203} {.pb.qs:setsql "select oid,* from phonebook where name ~* '$what' order by name"\
|
||||
.pb.qs:open\
|
||||
set nrecs [.pb.qs:nrecords]\
|
||||
.pb.qs:updatecontrols\
|
||||
.pb.qs:fill .pb.allnames name\
|
||||
bind .pb.allnames <ButtonRelease-1> {\
|
||||
set ancr [.pb.allnames curselection]\
|
||||
if {$ancr!=""} {\
|
||||
\ .pb.qs:moveto $ancr\
|
||||
\ .pb.qs:updatecontrols\
|
||||
}\
|
||||
}} Find {}} {button button9 {159 276 229 302} {.pb.qs:close\
|
||||
.pb.qs:clearcontrols\
|
||||
set nrecs {}\
|
||||
set what {}\
|
||||
destroy .pb\
|
||||
} Exit {}} {button button10 {102 249 124 269} {.pb.qs:movefirst\
|
||||
.pb.qs:updatecontrols\
|
||||
} |< {}} {button button11 {129 249 151 269} {.pb.qs:moveprevious\
|
||||
.pb.qs:updatecontrols\
|
||||
} << {}} {button button12 {156 249 178 269} {.pb.qs:movenext\
|
||||
.pb.qs:updatecontrols} >> {}} {button button13 {183 249 205 269} {.pb.qs:movelast\
|
||||
.pb.qs:updatecontrols\
|
||||
} >| {}} {checkbox checkbox14 {33 87 126 105} {} {Is it a company ?} pbqs(company)} {radio usa {63 108 201 120} {} U.S.A. pbqs(continent)} {radio europe {63 126 204 141} {} Europe pbqs(continent)} {radio africa {63 144 210 159} {} Africa pbqs(continent)} {entry entry18 {30 180 117 198} {} entry18 what} {label label19 {108 219 188 234} {} {records found} {}} {label label20 {90 219 105 234} {} { } nrecs} {label label21 {3 252 33 267} {} OID= {}} {label label22 {39 252 87 267} {} { } pbqs(oid)} {button button23 {9 276 79 302} {set oid {}\
|
||||
catch {set oid $pbqs(oid)}\
|
||||
if {[string trim $oid]!=""} {\
|
||||
sql_exec noquiet "update phonebook set name='$pbqs(name)', phone_nr='$pbqs(phone_nr)',city='$pbqs(city)',company='$pbqs(company)',continent='$pbqs(continent)' where oid=$oid"\
|
||||
} else {\
|
||||
tk_messageBox -title Error -message "No record is displayed!"\
|
||||
}\
|
||||
\
|
||||
} Update {}} {button button24 {84 276 154 302} {set thisname {}\
|
||||
catch {set thisname $pbqs(name)}\
|
||||
if {[string trim $thisname]!=""} {\
|
||||
sql_exec noquiet "insert into phonebook values ('$pbqs(name)','$pbqs(phone_nr)','$pbqs(city)','$pbqs(company)','$pbqs(continent)')"\
|
||||
tk_messageBox -title Information -message "A new record has been added!"\
|
||||
} else {\
|
||||
tk_messageBox -title Error -message "This one doesn't have a name ?\
|
||||
}\
|
||||
\
|
||||
} {Add new} {}} {button button25 {168 111 231 135} {.pb.qs:clearcontrols\
|
||||
# clearcontrols stillinitialise\
|
||||
# incorectly booleans controls to {}\
|
||||
# so I force it to 'f' (false)\
|
||||
set pbqs(company) f\
|
||||
focus .pb.name_entry} New {}} {listbox allnames {246 12 432 240} {} listbox26 {}}
|
||||
\.
|
||||
COPY "pga_scripts" FROM stdin;
|
||||
How are forms keeped inside ? open_table pga_forms\
|
||||
\
|
||||
|
||||
\.
|
||||
COPY "pga_reports" FROM stdin;
|
||||
\.
|
||||
COPY "phonebook" FROM stdin;
|
||||
IBM 623346234 \N t usa
|
||||
John Doe +44 35 2993825 Washington f usa
|
||||
Bill Clinton +44 35 9283845 New York f usa
|
||||
Monica Levintchi +44 38 5234526 Dallas f usa
|
||||
Bill Gates +42 64 4523454 Los Angeles f usa
|
||||
COMPAQ 623462345 \N t usa
|
||||
SUN 784563253 \N t usa
|
||||
DIGITAL 922644516 \N t usa
|
||||
FIAT 623463445 \N t europe
|
||||
MUGADUMBU +92 534662634 \N t africa
|
||||
Frank Zappa 6734567 Montreal f usa
|
||||
Jimmy Page 66323452 f europe
|
||||
Constantin Teodorescu +40 39 611820 Braila f europe
|
||||
Ngbendu Wazabanga 34577345 f africa
|
||||
Victor Ciorbea 634567 Bucuresti f europe
|
||||
Mugabe Kandalam 7635745 f africa
|
||||
\.
|
||||
COPY "pga_layout" FROM stdin;
|
||||
pga_forms 2 formname formsource 82 713
|
||||
phonebook 5 name phone_nr city company continent 150 105 80 66 85
|
||||
Usaisti 5 name phone_nr city company continent 150 150 150 150 150
|
||||
q1 5 name phone_nr city company continent 150 150 150 150 150
|
||||
view_saved_from_that_query 5 name phone_nr city company continent 150 150 150 150 150
|
||||
\.
|
@@ -1,216 +0,0 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i586) [Netscape]">
|
||||
</HEAD>
|
||||
<BODY TEXT="#000000" BGCOLOR="#FFEBCD" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">
|
||||
|
||||
<H1>
|
||||
FORMS</H1>
|
||||
|
||||
<HR WIDTH="100%">
|
||||
|
||||
<P>This version (0.83) of PgAccess has changed a little the visual form
|
||||
builder introduced since 0.82 version : variable handling, query results
|
||||
interface and control bindings naming convention. Please read it carefully,
|
||||
download the database demo and practice a while before trying to design
|
||||
your own forms.
|
||||
|
||||
<P>For the moment, it has only some basic widgets : labels, entries, buttons
|
||||
, listboxes , checkboxes and radiobuttons.
|
||||
|
||||
<P>Also there is a pseudo query widget that allows you yo have access to
|
||||
a query results.
|
||||
|
||||
<P><B>How do you generate widgets :</B>
|
||||
<OL>
|
||||
<LI>
|
||||
select a widget from the toolbox by clicking the appropriate radiobutton</LI>
|
||||
|
||||
<LI>
|
||||
move to the canvas , point with the mouse at the desired location and click
|
||||
the mouse button to begin</LI>
|
||||
|
||||
<LI>
|
||||
keeping the mouse-button pressed move the mouse in order to draw a rectangle
|
||||
that will hold the widget</LI>
|
||||
|
||||
<LI>
|
||||
release the mouse-button</LI>
|
||||
</OL>
|
||||
In the rectangle that you have designed it will appear the selected object.
|
||||
<BR>Move now to the attribute window to change some of its properties.
|
||||
|
||||
<P>Renaming, resizing items are possible (for the moment) only by modifying
|
||||
appropriate parameters in attribute window. You <B>must </B>press Enter
|
||||
in the edit field after changing a value in order to be accepted.
|
||||
|
||||
<P>You can also move items by dragging them or delete them by pressing
|
||||
Del key after selecting them.
|
||||
|
||||
<P>In attribute window, there are some fields named <B><TT><FONT SIZE=+1>Command
|
||||
</FONT></TT></B>and <B><TT><FONT SIZE=+1>Variable</FONT></TT></B>.
|
||||
|
||||
<P>The field <B><TT><FONT SIZE=+1>Command </FONT></TT></B>have meaning
|
||||
only for Button widgets and holds the command that will be invoked when
|
||||
the button is pressed.
|
||||
|
||||
<P> The field <B><TT><FONT SIZE=+1>Variable </FONT></TT></B>have
|
||||
meaning only for EditField , Label widgets , checkboxes and radiobuttons
|
||||
and it is the name of the global variable that will hold the value for
|
||||
that widget. For checkboxes the values are <B>t</B> and <B>f</B> (from
|
||||
true and false) in order to simplify binding to logical data fields (PgAccess
|
||||
0.82 used 0 and 1).
|
||||
|
||||
<P> For radiobuttons, it is usual to assign the same
|
||||
variable to the same radiobuttons within the same group. That variable
|
||||
will contain the name of the widget of the radiobutton that has been pressed.
|
||||
Let's presume that you have entered 3 radiobuttons named red, green and
|
||||
blue, all of them having the same variable named color. If you will press
|
||||
them, they will assign their names to global variable.
|
||||
|
||||
<P> In order to make a simple test, put an entry field
|
||||
and set it's variable to <B>v1</B> and a button who's command is "set v1
|
||||
whisky". Press the button "Test form" and click on the button. In that
|
||||
entry should appear whisky.
|
||||
<BR>Another test is defining in Script module a script called "My first
|
||||
script" having the following commands:
|
||||
<BR><TT><FONT SIZE=+1>tk_messageBox -title Warning -message "This is my
|
||||
first message!"</FONT></TT>
|
||||
<BR>and then define a button who's command is <B><TT><FONT SIZE=+1>execute_script
|
||||
"My first script"</FONT></TT></B>.
|
||||
<H2>
|
||||
Database manipulation</H2>
|
||||
Let's presume that our form have the internal name <B><TT>mf </TT></B>(my
|
||||
form). He will be referred inside the Tcl/Tk source as <B><TT>.mf</TT></B>
|
||||
<BR>If you want to close the form in run-time you have to issue the command
|
||||
<B><TT>destroy .mf</TT></B>
|
||||
|
||||
<P>Also, any widget will have the name prefixed by <B><TT>.mf </TT></B>
|
||||
We will have <B><TT>.mf.button1</TT></B> or <B><TT>.mf.listbox1</TT></B>
|
||||
.
|
||||
|
||||
<P>We can name the query widget <B><TT>qry</TT></B> for example. The complete
|
||||
name will be <B><TT>.mf.qry</TT></B> then.
|
||||
<BR>The <B><TT>Command </TT></B>property of the query widget must contain
|
||||
the SQL command that will be executed.
|
||||
<BR>When the form will be in run-time, automatically you will have access
|
||||
to the following procedures and functions :
|
||||
|
||||
<P><B><TT>.mf.qry:open</TT></B> - opens the connection and execute the
|
||||
query (returns nothing)
|
||||
<BR><B><TT>.mf.qry:setsql newsql</TT></B> - set the command query that
|
||||
will be executed at the next <B><TT>.mf.qry:open</TT></B>
|
||||
<BR><B><TT>.mf.qry:nrecords</TT></B> - returns the number of records in
|
||||
the selected query
|
||||
<BR><B><TT>.mf.qry:crtrecord </TT></B>- returns the current record number
|
||||
inside the query result
|
||||
<BR><B><TT>.mf.qry:fields</TT></B> - returns a list of the fields in the
|
||||
result set
|
||||
<BR><B><TT>.mf.qry:movefirst</TT></B> - move the cursor to the first record
|
||||
in the recordset
|
||||
<BR><B><TT>.mf.qry:movelast</TT></B><TT> , <B>.mf.qry:movenext</B> , <B>.mf.qry:moveprevious</B>
|
||||
</TT>- moves the cursor there
|
||||
<BR><B><TT>.mf.qry:moveto newrecno</TT></B> - move the cursor to that new
|
||||
record number (first is 0)
|
||||
<BR><B><TT>.mf.qry:updatecontrols</TT></B> - update the variables inside
|
||||
the designed form that have a particular name (I'll explain later)
|
||||
<BR><B><TT>.mf.qry:clearcontrols</TT></B> - clear the variables inside
|
||||
the designed form binded to a query result
|
||||
<BR><B><TT>.mf.qry:fill listbox field</TT></B><TT> </TT>- fill the named
|
||||
listbox (whole widget name as <B><TT>.mf.listbox1</TT></B>) with the all
|
||||
the values of that field in the current queryresult
|
||||
<BR><B><TT>.mf.qry:close</TT></B> - close the connection (<B><FONT COLOR="#FF0000">if
|
||||
you don't close the query result, you will loose some memory</FONT></B>)
|
||||
|
||||
<P>It's no need to close a query-result if you want to assign it a new
|
||||
SQL command and open it again. That will be done automatically.
|
||||
|
||||
<P>If you want to bound some controls to the fields of the recordset, you
|
||||
will have to name their associate variable like that :
|
||||
|
||||
<P><B><TT>mfqry(salary)</TT></B> to get the "salary" field , or <B><TT>mfqry(name)</TT></B>
|
||||
to get the "name" field. So, you take the internal name of the form (without
|
||||
the leading point) and merge it with the query-widget name and you will
|
||||
get a associative array name. The values are given using the field name
|
||||
as a key in this associative array.
|
||||
<BR><B><FONT COLOR="#FF0000">* WARNING *</FONT></B> The naming style has
|
||||
been changed from 0.82 version of PgAccess and I cannot guarantee that
|
||||
it not be changed again in the future. I'm just trying to make it as simple
|
||||
it could be. The old style naming convention had some incompatibilities
|
||||
with Tcl/Tk syntax.
|
||||
|
||||
<P><B><FONT SIZE=+1><FONT COLOR="#9400D3">QUESTION</FONT> : </FONT></B>Do
|
||||
you think that it would be more clear if the above functions and procedures
|
||||
regarding a query-widget would be named in a similar manner as binded variable
|
||||
controls ? That mean, <B><TT>mfqry:open</TT></B> and <B><TT>mfqry:updatecontrols</TT></B>
|
||||
instead of <B><TT>.mf.qry:open</TT></B> and <B><TT>.mf.qry:updatecontrols</TT></B>
|
||||
?
|
||||
|
||||
<P>The only advantage of <B><TT>.mf.qry:open</TT></B> is that is much closer
|
||||
to the Tk method of referring objects within a window and it may give to
|
||||
the programmer the feeling that he is using a object-oriented widget. Since
|
||||
I cannot use further for naming binded variables a similar manner (<B><TT>.mf.qry.salary)</TT></B>
|
||||
it might be possible to abandon that naming convention .
|
||||
|
||||
<P>Here it is a dumped <B><A HREF="formdemo.sql">sample database</A></B>
|
||||
that contains a demo database. What should you do ?
|
||||
<BR>Shift-click the above URL in order to download that tiny file (4 Kb).
|
||||
Create a empty database and <B><TT>psql yourdatabase <formdemo.sql</TT></B>
|
||||
|
||||
<P>You should find a single table called "phonebook" a form called "Phone
|
||||
book" and another "A simple demo form".
|
||||
|
||||
<P>First of all enter and view the phonebook table in table view. Note
|
||||
the fields and their values.
|
||||
<BR>Open the "Phone book" form and enter a letter (a, e or i) in the field
|
||||
to the left of "Find" button then press Find. It's fine to enter one letter
|
||||
in order to get more records in query result. You will get information
|
||||
about the number of records selected, in the listbox you will see all the
|
||||
values of field "name" from the current data set. Use buttons to move to
|
||||
first, next, previous or last record within the record set.
|
||||
|
||||
<P>In order to add a new record, press the "New" button in order to get
|
||||
new, clean entries. Fill them with your data and press "Add new" button.
|
||||
A new phonebook record will be added. Also, if you want to update a record,
|
||||
change it's values in the displayed fields after finding it and press "Update"
|
||||
button. The values will be updated in the database BUT NOT IN THE CURRENT
|
||||
QUERY RESULT . If you want to see them modified, make a new query trying
|
||||
to find it again.
|
||||
|
||||
<P><FONT COLOR="#000080">Before using the results from a query you should
|
||||
know that the information that has been retrieved could be found only in
|
||||
your computer client memory. It has <B>no live connection</B> to the data
|
||||
from the database. That's why it isn't possible to develop a simple update
|
||||
function as interface to that query-result widget. More than that : a query
|
||||
result could be obtained from a SQL command that return a non-updatable
|
||||
data set !!! For example fields gathered from multiple tables or summary
|
||||
fields. It isn't just simple to make an automatic update procedure. The
|
||||
programmer must know how to make the update or the append procedure, sometimes
|
||||
using key fields to point to the desired record or an OID. There are examples
|
||||
in the demo database in "Phone book" form. It may be possible that in the
|
||||
future, I will develop another pseudo-widget describing a table. It would
|
||||
be more simple than to implement an update or append or even a delete procedure.</FONT>
|
||||
|
||||
<P>There is in the demo database also another simple form called "A simple
|
||||
demo form". It will show you how to handle variables from checkboxes, radiobuttons,
|
||||
how to use listboxes, open another forms and so on. I think they will help
|
||||
you.
|
||||
|
||||
<P>In order to avoid naming user defined forms with a particular
|
||||
name of another PgAccess form, I would recommend naming them as udf0, udf1
|
||||
(user defined form 0 , 1 )
|
||||
|
||||
<P>
|
||||
<HR WIDTH="25%">
|
||||
|
||||
<P>Please feel free to send me your opinion at <B>teo@flex.ro</B> on forms
|
||||
designing and usage.
|
||||
|
||||
<P><B><FONT SIZE=+1>KEEP IN MIND !
|
||||
THE FORM API WILL CHANGE IN ORDER TO BE MORE SIMPLE AND BETTER!
|
||||
SEND ME YOUR WISHES, YOUR IDEAS, YOUR OPINIONS !</FONT></B>
|
||||
<BR><B><FONT SIZE=+1>ALSO ... DON'T BLAME ME IF YOU WILL HAVE TO RE-DESIGN
|
||||
YOUR OLD FORMS DUE TO SOME INCOMPATIBILITIES WITH NEWER PGACCESS VERSIONS.</FONT></B>
|
||||
</BODY>
|
||||
</HTML>
|
BIN
src/bin/pgaccess/images/icon_button.gif
Normal file
After Width: | Height: | Size: 896 B |
BIN
src/bin/pgaccess/images/icon_checkbutton.gif
Normal file
After Width: | Height: | Size: 873 B |
BIN
src/bin/pgaccess/images/icon_entry.gif
Normal file
After Width: | Height: | Size: 907 B |
BIN
src/bin/pgaccess/images/icon_frame.gif
Normal file
After Width: | Height: | Size: 908 B |
BIN
src/bin/pgaccess/images/icon_label.gif
Normal file
After Width: | Height: | Size: 80 B |
BIN
src/bin/pgaccess/images/icon_listbox.gif
Normal file
After Width: | Height: | Size: 896 B |
BIN
src/bin/pgaccess/images/icon_query.gif
Normal file
After Width: | Height: | Size: 897 B |
BIN
src/bin/pgaccess/images/icon_radiobutton.gif
Normal file
After Width: | Height: | Size: 870 B |
BIN
src/bin/pgaccess/images/icon_text.gif
Normal file
After Width: | Height: | Size: 911 B |
@@ -1,134 +0,0 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.5 [en] (X11; I; Linux 2.0.36 i586) [Netscape]">
|
||||
<title>PgAccess - a Tcl/Tk PostgreSQL interface</title>
|
||||
</head>
|
||||
<body bgcolor="#FFFFFF">
|
||||
|
||||
<h1>
|
||||
PgAccess - a free database management tool for <a href="http://www.postgreSQL.org">PostgreSQL</a></h1>
|
||||
|
||||
<hr>
|
||||
<li>
|
||||
Download the last version of PgAccess <a href="pgaccess-0.96.tar.gz">(press
|
||||
shift and click this link) (tar.gz file)</a> or <a href="pgaccess.zip">this
|
||||
one (zip file for Windows)</a></li>
|
||||
|
||||
<p><br>
|
||||
<center>
|
||||
<p>Latest stable version of PgAccess is 0.96 , released 9 March 1999
|
||||
!
|
||||
<p><font size=+2>PgAccess 0.93 and higher will not work from the begining
|
||||
with PostgreSQL 6.3.x !!<br>
|
||||
Read <a href="pg93patch.html">here</a> how to apply a simple patch in order
|
||||
to make it work !</font>
|
||||
<br>
|
||||
<p><font size=+2><b><font color="#FF0000">NEW *</font></b> <b><font color="#FF0000">NEW
|
||||
*</font></b></font><b><font color="#FF0000"> </font><font color="#000000"><font size=+1>
|
||||
==> </font><font size=+2>Microsoft Windows compatible version</font></font></b>
|
||||
<p> <b><font color="#FF0000">NEW *</font></b> ==== > <b>PostgreSQL
|
||||
user management, multiple table views</b>,. <b>Query parameters</b> (see
|
||||
section Queries below)
|
||||
<p>Precompiled libpgtcl and libpq binaries and dll's for i386 are <a href="ftp://ftp.flex.ro/pub/pgaccess">here
|
||||
</a>!!!</center>
|
||||
|
||||
<h3>
|
||||
<font color="#000080">Installation problems</font></h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Some problems related with locale special characters could be solved by
|
||||
this <a href="specialchars.html">simple patch</a></li>
|
||||
|
||||
<li>
|
||||
I think that there were some problems loading libpgtcl library. I invite
|
||||
you to read a <a href="index.html#libpgtcl">special section concerning
|
||||
libpgtcl</a></li>
|
||||
|
||||
<li>
|
||||
For Silicon Graphics Indigo computers, Irix operating system, there is
|
||||
a <a href="irix.html">HOWTO make PgAccess to work</a></li>
|
||||
</ul>
|
||||
|
||||
<h3>
|
||||
<font color="#191970">What does PgAccess now!</font></h3>
|
||||
Here are some screenshots from PgAccess windows : <a href="pic-pga-1.gif">Main
|
||||
window </a>, <a href="pic-pga-2.gif">table builder </a>, <a href="pic-pga-4.gif">table(query)
|
||||
view </a>, <a href="pic-pga-3.gif">visual query builder </a>.
|
||||
<p><b>Tables</b>
|
||||
<br>- opening multiple tables for viewing, max. n records (changed by preferences
|
||||
menu)
|
||||
<br>- column resizing, dragging the vertical grid line (better in table
|
||||
space rather than in the table header)
|
||||
<br>- text wrap in cells - layout saved for every table
|
||||
<br>- import/export to external files (SDF,CSV)
|
||||
<br>- filter capabilities (enter filter like (price>3.14)
|
||||
<br>- sort order capabilities (enter manually the sort field(s))
|
||||
<br>- editing in place
|
||||
<br>- improved table generator assistant
|
||||
<br>- improved field editing
|
||||
<br><b>Queries</b>
|
||||
<br>- define , edit and stores "user defined queries"
|
||||
<br>- store queries as views
|
||||
<br>- execution of queries with optional user input parameters ( select
|
||||
* from invoices where year=[parameter "Year of selection"] )
|
||||
<br>- viewing of select type queries result
|
||||
<br>- query deleting and renaming
|
||||
<br>- visual query builder with drag & drop capabilities. For any of
|
||||
you who had installed the Tcl/Tk plugin for Netscape Navigator, you can
|
||||
see it at work <a href="qbtclet.html">clicking here</a>
|
||||
<br><b>Sequences</b>
|
||||
<br>- defines sequences, delete them and inspect them
|
||||
<br><b>Functions</b>
|
||||
<br>- define, inspect and delete functions in SQL language
|
||||
<br><b>Reports</b>
|
||||
<br>- design and display simple reports from tables
|
||||
<br>- fields and labels, font changing, style and size
|
||||
<br>- saves and loads report description from database
|
||||
<br>- show report previews, sample postscript output file
|
||||
<br><b>Forms</b>
|
||||
<br>- open user defined forms
|
||||
<br>- form design module available
|
||||
<br>- query widget available, controls bound to query results
|
||||
<br>- <a href="forms.html">click here</a> for a description of forms and
|
||||
how they can be used
|
||||
<br><b>Scripts</b>
|
||||
<br>- define, modify and call user defined scripts
|
||||
<br><b>Users</b>
|
||||
<br>- define and modify user parameters
|
||||
<p>Here is <a href="pga-rad.html">a special section concerning forms and
|
||||
scripts</a> .
|
||||
<p>This program is protected by the following <a href="copyright.html">copyright</a>
|
||||
<p>If you have any comment, suggestion for improvements, please feel free
|
||||
to e-mail to : <a href="mailto:teo@flex.ro">teo@flex.ro</a>
|
||||
<p><b><font color="#FF1493"><font size=+2>Mailing list for PgAccess </font></font></b><a href="maillist.html">Here
|
||||
you will find how to subscribe to this mailing list</a>.
|
||||
<p>
|
||||
<hr>
|
||||
<h1>
|
||||
More information about libpgtcl - downloads</h1>
|
||||
Also, you will need the PostgreSQL to Tcl interface
|
||||
library, lined as a Tcl/Tk 'load'-able module. It is called libpgtcl and
|
||||
the source is located in the PostgreSQL directory /src/interfaces/libpgtcl.
|
||||
Specifically, you will need a libpgtcl library that is 'load'-able from
|
||||
Tcl/Tk. This is technically different from
|
||||
an ordinary PostgreSQL loadable object file, because libpgtcl is a collection
|
||||
of object files. Under Linux, this is called libpgtcl.so.
|
||||
<p> One of the solutions is to remove from the
|
||||
source the line containing <b>load libpgtcl.so </b>and to load pgaccess.tcl
|
||||
not with wish, but with pgwish (or wishpg) that wish that was linked with
|
||||
libpgtcl library! I do not recommend this one.
|
||||
<p> If you have installed RedHat 5.x, you should
|
||||
get the last distribution kit of PostgreSQL and compile it from scratch.
|
||||
RedHat 5.x is using some new versions of libraries and you have to compile
|
||||
and install again at least <b>libpq </b>and <b><tt>libpgtcl </tt></b>libraries.
|
||||
<p> PostgreSQL 6.4 release has a minor bug. I does not
|
||||
includ by default the crypt lib when compiling libpgtcl. So, you will need
|
||||
to manually add a -lcrypt to SHLIB line in Makefile in src/interfaces/libpgtcl
|
||||
and then make clean and make again. The new libpgtcl.so library is properly
|
||||
configured to run pgaccess.
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
10
src/bin/pgaccess/lib/help/abort.hlp
Normal file
@@ -0,0 +1,10 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"ABORT" {bold} " rolls back the current transaction and causes all the updates made by the transaction to be discarded. This command is identical in behavior to the SQL92 command ROLLBACK, and is present only for historical reasons.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
" {} "ABORT" {code} "
|
||||
|
||||
" {} "Compatibility SQL92" {bold} "
|
||||
|
||||
This command is a Postgres extension present for historical reasons. " {} "ROLLBACK" {bold} " is the SQL92 equivalent command."
|
7
src/bin/pgaccess/lib/help/add_records.hlp
Normal file
@@ -0,0 +1,7 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Adding new records to an existing table" {bold} "
|
||||
|
||||
" {} "Open a table for viewing and editing" {link open_table} " and move to the end of the displayed records using the vertical scrollbar. You will find there a single row containing only * characters. Click with the mouse on a field and start edit the new record. Move through the fields using Tab and Shift-Tab.
|
||||
The new record will be saved into the database when you will select another record (or press on the mouse right-button).
|
||||
"
|
||||
|
30
src/bin/pgaccess/lib/help/alter_table.hlp
Normal file
@@ -0,0 +1,30 @@
|
||||
.pgaw:Help.f.t insert end "ALTER TABLE" {bold} " changes the definition of an existing table. The new columns and their types are specified in the same style and with the the same restrictions as in CREATE TABLE. The RENAME clause causes the name of a table or column to change without changing any of the data contained in the affected table. Thus, the table or column will remain of the same type and size after this command is executed.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
ALTER TABLE table \[ * \] ADD \[ COLUMN \] column type
|
||||
ALTER TABLE table \[ * \] RENAME \[ COLUMN \] column TO newcolumn
|
||||
ALTER TABLE table RENAME TO newtable
|
||||
|
||||
" {code} "table" {italic} "
|
||||
The name of an existing table to alter.
|
||||
|
||||
" {} "column" {italic} "
|
||||
Name of a new or existing column.
|
||||
|
||||
" {} "type " {italic} "
|
||||
Type of the new column.
|
||||
|
||||
" {} "newcolumn " {italic} "
|
||||
New name for an existing column.
|
||||
|
||||
" {} "newtable " {italic} "
|
||||
New name for an existing column.
|
||||
|
||||
You must own the table in order to change its schema.
|
||||
|
||||
" {} "Notes:" {italic} " The keyword COLUMN is noise and can be omitted.
|
||||
|
||||
\"\[*\]\" following a name of a table indicates that statement should be run over that table and all tables below it in the inheritance hierarchy. The PostgreSQL User's Guide has further information on inheritance.
|
||||
|
||||
Refer to " {} "CREATE TABLE" {link create_table} " for a further description of valid arguments."
|
49
src/bin/pgaccess/lib/help/alter_user.hlp
Normal file
@@ -0,0 +1,49 @@
|
||||
.pgaw:Help.f.t insert end "ALTER USER" {bold} " is used to change the attributes of a user's Postgres account. Please note that \
|
||||
it is not possible to alter a user's " {} "usesysid" {bold} " via the alter user statement. Also, it is only possible for \
|
||||
the Postgres user or any user with read and modify permissions on " {} "pg_shadow" {bold} " to alter user passwords. \
|
||||
If any of the clauses of the alter user statement are omitted, the corresponding value in the " {} "pg_shadow" {bold} " table is left unchanged. \
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
ALTER USER username
|
||||
\[ WITH PASSWORD password \]
|
||||
\[ CREATEDB | NOCREATEDB \]
|
||||
\[ CREATEUSER | NOCREATEUSER \]
|
||||
\[ IN GROUP groupname \[, ...\] \]
|
||||
\[ VALID UNTIL 'abstime' \]
|
||||
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
Refer to CREATE USER for a detailed description of each clause.
|
||||
|
||||
" {} "username" {italic} "
|
||||
The Postgres account name of the user whose details are to be altered.
|
||||
|
||||
" {} "password" {italic} "
|
||||
The new password to be used for this account.
|
||||
|
||||
" {} "groupname" {italic} "
|
||||
The name of an access group into which this account is to be put.
|
||||
|
||||
" {} "abstime" {italic} "
|
||||
The date (and, optionally, the time) at which this user's access is to be terminated.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "ALTER USER" {italic} "
|
||||
Message returned if the alteration was successful.
|
||||
|
||||
" {} "ERROR: alterUser: user 'username' does not exist" {italic} "
|
||||
Error message returned if the user specified doesn't exist.
|
||||
|
||||
" {} "Notes" {italic} "
|
||||
|
||||
" {} "ALTER USER" {bold} " statement is a Postgres language extension.
|
||||
Refer to CREATE/DROP USER to create or remove a user account.
|
||||
In the current release (v6.5), the IN GROUP clause is parsed but has no affect. When it is fully implemented, it is intended to modify the pg_group relation.
|
||||
|
||||
" {} "Compatibility" {bold} "
|
||||
|
||||
SQL92
|
||||
There is no ALTER USER statement in SQL92. The standard leaves the definition of users to the \
|
||||
implementation."
|
12
src/bin/pgaccess/lib/help/author.hlp
Normal file
@@ -0,0 +1,12 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"The author of PgAccess\n" {title} \
|
||||
"
|
||||
My name is Constantin Teodorescu, I'm 36 years old, I have graduated the Faculty of Computers and Automation Bucharest, ROMANIA, I have a 16 year experience in developing applications in various languages, Pascal, C, C++, Visual Basic, Delphi, Perl , Tcl/Tk and Java for different platforms. Currently working as a manager of a team that works in Unix with Java , SQL databases (Oracle, SYBASE) currently using PostgreSQL database for developing professional client/server multi-platform applications (standalone Java or Tcl/Tk ,Java applets) for different customers and various projects (accounting, invoicing, stock inventory).
|
||||
|
||||
In present I am the technical manager of FLEX Consulting Braila, a computer shop, software company, networking designer and consultant, ISP provider for Braila city. I'm also a columnist in the romanian technical magazine \"PC-Magazine\" and \"BYTE\".
|
||||
|
||||
I have discovered PostgreSQL in 1995 and from the first moment I decided to help it's development writting PgAccess, a graphical interface.
|
||||
|
||||
The work has been done using Visual Tcl, in my opinion the best tool for developing Tcl/Tk projects. Visual Tcl is free, more information at http://www.neuron.com/stewart/vtcl/index.html
|
||||
|
||||
I'm waiting for any suggestions at e-mail address teo@flex.ro"
|
35
src/bin/pgaccess/lib/help/begin.hlp
Normal file
@@ -0,0 +1,35 @@
|
||||
.pgaw:Help.f.t insert end "BEGIN" {bold} "
|
||||
By default, Postgres executes transactions in unchained mode (also known as " {} "autocommit" {bold} " in other database systems). In other words, each user statement is executed in its own transaction \
|
||||
and a commit is implicitly performed at the end of the statement (if execution was successful, otherwise a rollback is done). BEGIN initiates a user transaction in chained mode, i.e. all user \
|
||||
statements after BEGIN command will be executed in a single transaction until an explicit COMMIT, ROLLBACK or execution abort. Statements in chained mode are executed much faster, \
|
||||
because transaction start/commit requires significant CPU and disk activity. Execution of multiple statements inside a transaction is also required for consistency when changing several related \
|
||||
tables. \
|
||||
The default transaction isolation level in Postgres is READ COMMITTED, where queries inside the transaction see only changes committed before query execution. So, you have to use SET \
|
||||
TRANSACTION ISOLATION LEVEL SERIALIZABLE just after BEGIN if you need more rigorous transaction isolation. In SERIALIZABLE mode queries will see only changes committed \
|
||||
before the entire transaction began (actually, before execution of the first DML statement in a serializable transaction). \
|
||||
If the transaction is committed, Postgres will ensure either that all updates are done or else that none of them are done. Transactions have the standard ACID (atomic, consistent, isolatable, and durable) property.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
BEGIN \[ WORK | TRANSACTION \]
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
The keyword TRANSACTION is just a cosmetic alternative to WORK. Neither keyword need be specified.
|
||||
Refer to the LOCK statement for further information about locking tables inside a transaction.
|
||||
Use " {} "COMMIT" {link commit} " or " {} "ROLLBACK" {link rollback} " to terminate a transaction.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
To begin a user transaction:
|
||||
|
||||
" {} "BEGIN WORK;" {italic} "
|
||||
|
||||
" {} "Compatibility" {bold} "
|
||||
BEGIN is a Postgres language extension.
|
||||
|
||||
" {} "SQL92" {bold} "
|
||||
|
||||
There is no explicit BEGIN WORK command in SQL92; transaction initiation is always implicit and it terminates either with a COMMIT or with a ROLLBACK statement.
|
||||
|
||||
Note: Many relational database systems offer an autocommit feature as a convenience.
|
||||
|
||||
SQL92 also requires SERIALIZABLE to be the default transaction isolation level. "
|
22
src/bin/pgaccess/lib/help/close.hlp
Normal file
@@ -0,0 +1,22 @@
|
||||
.pgaw:Help.f.t insert end "CLOSE" {bold} " frees the resources associated with an open cursor. After the cursor is closed, no subsequent operations are allowed on it. A cursor should be closed when it is no longer needed. \
|
||||
An implicit close is executed for every open cursor when a transaction is terminated by \
|
||||
" {} "COMMIT" {link commit} " or " {} "ROLLBACK" {link rollback} ".
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CLOSE cursor
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
Close the cursor liahona:
|
||||
|
||||
CLOSE liahona;
|
||||
|
||||
" {} "Compatibility" {bold} "
|
||||
|
||||
SQL92
|
||||
CLOSE is fully compatible with SQL92
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
Postgres does not have an explicit OPEN cursor statement; a cursor is considered open when it is declared. Use the DECLARE statement to declare a cursor."
|
48
src/bin/pgaccess/lib/help/cluster.hlp
Normal file
@@ -0,0 +1,48 @@
|
||||
.pgaw:Help.f.t insert end "CLUSTER" {bold} " instructs Postgres to cluster the class specified by classname approximately based on the index specified by indexname. The index must already have been defined on classname. \
|
||||
When a class is clustered, it is physically reordered based on the index information. The clustering is static. In other words, as the class is updated, the changes are not clustered. No attempt is \
|
||||
made to keep new instances or updated tuples clustered. If one wishes, one can recluster manually by issuing the command \
|
||||
again.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
CLUSTER indexname ON table
|
||||
|
||||
" {} "Inputs" {bold} "
|
||||
|
||||
" {} "indexname" {italic} "
|
||||
The name of an index.
|
||||
|
||||
" {} "table" {italic} "
|
||||
The name of a table.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
CLUSTER
|
||||
The clustering was done successfully.
|
||||
ERROR: relation <tablerelation_number> inherits \"invoice\"
|
||||
ERROR: Relation x does not exist!
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
Cluster the employees relation on the basis of its salary attribute
|
||||
|
||||
CLUSTER emp_ind ON emp
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
The table is actually copied to a temporary table in index order, then renamed back to the original name. For this reason, all grant permissions and other indexes are lost when clustering is \
|
||||
performed.
|
||||
In cases where you are accessing single rows randomly within a table, the actual order of the data in the heap table is unimportant. However, if you tend to access some data more than others, \
|
||||
and there is an index that groups them together, you will benefit from using CLUSTER.
|
||||
Another place CLUSTER is helpful is in cases where you use an index to pull out several rows from a table. If you are requesting a range of indexed values from a table, or a single indexed \
|
||||
value that has multiple rows that match, CLUSTER will help because once the index identifies the heap page for the first row that matches, all other rows that match are probably already on the \
|
||||
same heap page, saving disk accesses and speeding up the query.
|
||||
There are two ways to cluster data. The first is with the CLUSTER command, which reorders the original table with the ordering of the index you specify. This can be slow on large tables \
|
||||
because the rows are fetched from the heap in index order, and if the heap table is unordered, the entries are on random pages, so there is one disk page retrieved for every row moved. Postgres \
|
||||
has a cache, but the majority of a big table will not fit in the cache.
|
||||
|
||||
Another way to cluster data is to use
|
||||
|
||||
SELECT ... INTO TABLE temp FROM ... ORDER BY ...
|
||||
|
||||
This uses the Postgres sorting code in ORDER BY to match the index, and is much faster for unordered data. You then drop the old table, use ALTER TABLE/RENAME to rename temp to \
|
||||
the old name, and recreate any indexes. The only problem is that OIDs will not be preserved. From then on, CLUSTER should be fast because most of the heap data has already been ordered, \
|
||||
and the existing index is used. "
|
17
src/bin/pgaccess/lib/help/commit.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "COMMIT" {bold} " commits the current transaction. All changes made by the transaction become visible to others and are guaranteed to be durable if a crash occurs.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
COMMIT \[ WORK | TRANSACTION \]
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
To make all changes permanent:
|
||||
|
||||
COMMIT WORK;
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
The keywords WORK and TRANSACTION are noise and can be omitted.
|
||||
|
||||
Use " {} "ROLLBACK" {link rollback} " to abort a transaction."
|
105
src/bin/pgaccess/lib/help/copy.hlp
Normal file
@@ -0,0 +1,105 @@
|
||||
.pgaw:Help.f.t insert end "COPY" {bold} " moves data between Postgres tables and standard Unix files. COPY instructs the Postgres backend to directly read from or write to a file. The file must be directly visible to the backend \
|
||||
and the name must be specified from the viewpoint of the backend. If stdin or stdout are specified, data flows through the client frontend to the backend.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
COPY \[ BINARY \] table \[ WITH OIDS \]
|
||||
FROM { 'filename' | stdin }
|
||||
\[ USING DELIMITERS 'delimiter' \]
|
||||
COPY \[ BINARY \] table \[ WITH OIDS \]
|
||||
TO { 'filename' | stdout }
|
||||
\[ USING DELIMITERS 'delimiter' \]
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "BINARY" {italic} "
|
||||
Changes the behavior of field formatting, forcing all data to be stored or read as binary objects rather than as text.
|
||||
|
||||
" {} "table" {italic} "
|
||||
The name of an existing table.
|
||||
|
||||
" {} "WITH OIDS" {italic} "
|
||||
Copies the internal unique object id (OID) for each row.
|
||||
|
||||
" {} "filename" {italic} "
|
||||
The absolute Unix pathname of the input or output file.
|
||||
|
||||
" {} "stdin" {italic} "
|
||||
Specifies that input comes from a pipe or terminal.
|
||||
|
||||
" {} "stdout" {italic} "
|
||||
Specifies that output goes to a pipe or terminal.
|
||||
|
||||
" {} "delimiter" {italic} "
|
||||
A character that delimits the input or output fields.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "COPY" {italic} "
|
||||
The copy completed successfully.
|
||||
|
||||
" {} "ERROR: error message" {italic} "
|
||||
The copy failed for the reason stated in the error message.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
The following example copies a table to standard output, using a vertical bar \(\"|\"\) as the field delimiter:
|
||||
COPY country TO stdout USING DELIMITERS '|';
|
||||
|
||||
To copy data from a Unix file into a table \"country\":
|
||||
COPY country FROM '/usr1/proj/bray/sql/country_data';
|
||||
|
||||
Here is a sample of data suitable for copying into a table from stdin \(so it has the termination sequence on the last \
|
||||
line\):
|
||||
|
||||
AF AFGHANISTAN
|
||||
AL ALBANIA
|
||||
DZ ALGERIA
|
||||
...
|
||||
ZM ZAMBIA
|
||||
ZW ZIMBABWE
|
||||
\.
|
||||
|
||||
" {} "File Formats" {bold} "
|
||||
|
||||
" {} "Text Format" {italic} "
|
||||
When COPY TO is used without the BINARY option, the file generated will have each row \(instance\) on a single line, with each column \
|
||||
\(attribute\) separated by the delimiter character. Embedded delimiter characters will be preceded by a backslash character \
|
||||
\(\"\\\"\). The attribute values themselves are strings generated by the output function associated with each attribute type. \
|
||||
The output function for a type should not try to generate the backslash character; this will be handled by COPY itself.
|
||||
|
||||
The actual format for each instance is
|
||||
|
||||
<attr1><separator><attr2><separator>...<separator><attrn><newline>
|
||||
The oid is placed on the beginning of the line if WITH OIDS is specified.
|
||||
|
||||
If " {} "COPY" {bold} " is sending its output to standard output instead of a file, it will send a backslash\(\"\\\"\) and a period \
|
||||
\(\".\"\) followed immediately by a newline, on a separate line, when it is done. Similarly, \
|
||||
if " {} "COPY" {bold} " is reading from standard input, it will expect a backslash \(\"\\\"\) and a period \
|
||||
\(\".\"\) followed by a newline, as the first three characters on a line to denote end-of-file. However, COPY will \
|
||||
terminate \(followed by the backend itself\) if a true EOF is encountered before this special end-of-file pattern is found.
|
||||
|
||||
The backslash character has other special meanings. NULL attributes are represented as \"\\N\". A literal backslash character is represented as two consecutive backslashes \
|
||||
\(\"\\\\\"\). A literal tab character is represented as a backslash and a tab. A literal newline character is represented as a backslash and a newline. When loading text data not generated by Postgres, you will need to \
|
||||
convert backslash characters \(\"\\\"\) to double-backslashes \(\"\\\\\"\) to ensure that they are loaded properly.
|
||||
|
||||
" {} "Binary Format" {italic} "
|
||||
|
||||
In the case of " {} "COPY BINARY" {bold} ", the first four bytes in the file will be the number of instances in the file. If this number is zero, the \
|
||||
" {} "COPY BINARY" {bold} " command will read until end of file is encountered. Otherwise, it will stop reading when this number of instances has been read. Remaining data in the file will be ignored. \
|
||||
The format for each instance in the file is as follows. Note that this format must be followed exactly. Unsigned four-byte integer quantities are called uint32 in the table below.
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
The " {} "BINARY" {bold} " keyword will force all data to be stored/read as binary objects rather than as text. It is somewhat faster than the normal copy command, but is not generally portable, and the files \
|
||||
generated are somewhat larger, although this factor is highly dependent on the data itself. By default, a text copy uses a tab \
|
||||
\(\"\\t\"\) character as a delimiter. The delimiter may also be changed to any other single character with the keyword phrase USING DELIMITERS. Characters in data fields which happen to match the delimiter character will be quoted.
|
||||
|
||||
You must have select access on any table whose values are read by " {} "COPY" {bold} ", and either insert or update access to a table into which values are being inserted by \
|
||||
" {} "COPY" {bold} ". The backend also needs appropriate Unix permissions for any file read or written by \
|
||||
" {} "COPY" {bold} ".
|
||||
|
||||
The keyword phrase " {} "USING DELIMITERS" {bold} " specifies a single character to be used for all delimiters between columns. If multiple characters are specified in the delimiter string, only the first \
|
||||
character is used.
|
||||
|
||||
Tip: Do not confuse " {} "COPY" {bold} " with the psql instruction \\copy. "
|
11
src/bin/pgaccess/lib/help/copyrights.hlp
Normal file
@@ -0,0 +1,11 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Copyrights\n\n" {title} \
|
||||
"
|
||||
PostgreSQL is Copyright <20> 1996-9 by the PostgreSQL Global Development Group, and is distributed under the terms of the Berkeley license.
|
||||
|
||||
Postgres95 is Copyright <20> 1994-5 by the Regents of the University of California. Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
|
||||
|
||||
In no event shall the University of California be liable to any party for direct, indirect, special, incidental, or consequential damages, including lost profits, arising out of the use of this software and its documentation, even if the University of California has been advised of the possibility of such damage.
|
||||
|
||||
The University of California specifically disclaims any warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The software provided hereunder is on an \"as-is\" basis, and the University of California has no obligations to provide maintainance, support, updates, enhancements, or modifications.
|
||||
"
|
90
src/bin/pgaccess/lib/help/create_aggregate.hlp
Normal file
@@ -0,0 +1,90 @@
|
||||
.pgaw:Help.f.t insert end "CREATE AGGREGATE" {bold} " allows a user or programmer to extend Postgres functionality by defining new aggregate functions. Some aggregate functions for base types such as \
|
||||
min\(int4\) and avg(float8) are already provided in the base distribution. If one defines new types or needs an aggregate function not already provided then CREATE AGGREGATE can be used to provide \
|
||||
the desired features.
|
||||
|
||||
An aggregate function can require up to three functions, two state transition functions, sfunc1 and sfunc2:
|
||||
sfunc1( internal-state1, next-data_item ) ---> next-internal-state1
|
||||
sfunc2( internal-state2 ) ---> next-internal-state2
|
||||
|
||||
and a final calculation function, ffunc:
|
||||
|
||||
ffunc(internal-state1, internal-state2) ---> aggregate-value
|
||||
|
||||
Postgres creates up to two temporary variables (referred to here as temp1 and temp2) to hold intermediate results used as arguments to the transition functions.
|
||||
|
||||
These transition functions are required to have the following properties:
|
||||
|
||||
The arguments to sfunc1 must be temp1 of type sfunc1_return_type and column_value of type data_type. The return value must be of type sfunc1_return_type and will be used as
|
||||
the first argument in the next call to sfunc1.
|
||||
|
||||
The argument and return value of sfunc2 must be temp2 of type sfunc2_return_type.
|
||||
|
||||
The arguments to the final-calculation-function must be temp1 and temp2 and its return value must be a Postgres base type (not necessarily data_type which had been specified for
|
||||
BASETYPE).
|
||||
|
||||
FINALFUNC should be specified if and only if both state-transition functions are specified.
|
||||
|
||||
An aggregate function may also require one or two initial conditions, one for each transition function. These are specified and stored in the database as fields of type text.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
CREATE AGGREGATE name \[ AS \]
|
||||
( BASETYPE = data_type
|
||||
\[ , SFUNC1 = sfunc1
|
||||
, STYPE1 = sfunc1_return_type \]
|
||||
\[ , SFUNC2 = sfunc2
|
||||
, STYPE2 = sfunc2_return_type \]
|
||||
\[ , FINALFUNC = ffunc \]
|
||||
\[ , INITCOND1 = initial_condition1 \]
|
||||
\[ , INITCOND2 = initial_condition2 \]
|
||||
)
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "name" {italic} "
|
||||
The name of an aggregate function to create.
|
||||
|
||||
" {} "data_type" {italic} "
|
||||
The fundamental data type on which this aggregate function operates.
|
||||
|
||||
" {} "sfunc1" {italic} "
|
||||
The state transition function to be called for every non-NULL field from the source column. It takes a variable of type sfunc1_return_type as the first argument and that field as the
|
||||
second argument.
|
||||
|
||||
" {} "sfunc1_return_type" {italic} "
|
||||
The return type of the first transition function.
|
||||
|
||||
" {} "sfunc2" {italic} "
|
||||
The state transition function to be called for every non-NULL field from the source column. It takes a variable of type sfunc2_return_type as the only argument and returns a variable
|
||||
of the same type.
|
||||
|
||||
" {} "sfunc2_return_type" {italic} "
|
||||
The return type of the second transition function.
|
||||
|
||||
" {} "ffunc" {italic} "
|
||||
The final function called after traversing all input fields. This function must take two arguments of types sfunc1_return_type and sfunc2_return_type.
|
||||
|
||||
" {} "initial_condition1" {italic} "
|
||||
The initial value for the first transition function argument.
|
||||
|
||||
" {} "initial_condition2" {italic} "
|
||||
The initial value for the second transition function argument.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "CREATE" {italic} "
|
||||
|
||||
Message returned if the command completes successfully.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
Refer to the chapter on aggregate functions in the PostgreSQL Programmer's Guide on aggregate functions for complete examples of usage.
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
Use " {} "DROP AGGREGATE" {bold} " to drop aggregate functions.
|
||||
|
||||
It is possible to specify aggregate functions that have varying combinations of state and final functions. For example, the count aggregate requires SFUNC2 (an incrementing function) but not \
|
||||
SFUNC1 or FINALFUNC, whereas the sum aggregate requires SFUNC1 (an addition function) but not SFUNC2 or FINALFUNC and the avg aggregate requires both of the above state \
|
||||
functions as well as a FINALFUNC (a division function) to produce its answer. In any case, at least one state function must be defined, and any SFUNC2 must have a corresponding \
|
||||
INITCOND2."
|
59
src/bin/pgaccess/lib/help/create_database.hlp
Normal file
@@ -0,0 +1,59 @@
|
||||
.pgaw:Help.f.t insert end "CREATE DATABASE" {bold} " creates a new Postgres database. The creator becomes the administrator of the new database.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
CREATE DATABASE name \[ WITH LOCATION = 'dbpath' \]
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "name" {italic} "
|
||||
The name of a database to create.
|
||||
|
||||
" {} "dbpath" {italic} "
|
||||
An alternate location can be specified as either an environment variable known to the backend server (e.g. 'PGDATA2') or as an absolute path name (e.g. '/usr/local/pgsql/data'). In \
|
||||
either case, the location must be pre-configured by initlocation.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "CREATEDB" {italic} "
|
||||
Message returned if the command completes successfully.
|
||||
|
||||
" {} "WARN: createdb: database \"name\" already exists." {italic} "
|
||||
This occurs if database specified already exists.
|
||||
|
||||
" {} "ERROR: Unable to create database directory directory" {italic} "
|
||||
There was a problem with creating the required directory; this operation will need permissions for the postgres user on the specified location.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
To create a new database:
|
||||
|
||||
olly=> create database lusiadas;
|
||||
|
||||
To create a new database in an alternate area ~/private_db:
|
||||
|
||||
$ mkdir private_db
|
||||
$ initlocation ~/private_db
|
||||
Creating Postgres database system directory /home/olly/private_db/base
|
||||
|
||||
$ psql olly
|
||||
Welcome to the POSTGRESQL interactive sql monitor:
|
||||
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
|
||||
|
||||
type \\? for help on slash commands
|
||||
type \\q to quit
|
||||
type \\g or terminate with semicolon to execute query
|
||||
You are currently connected to the database: template1
|
||||
|
||||
olly=> create database elsewhere with location = '/home/olly/private_db';
|
||||
|
||||
" {} "Bugs" {bold} "
|
||||
|
||||
There are security and data integrity issues involved with using alternate database locations specified with absolute path names, and by default only an environment variable known to the \
|
||||
backend may be specified for an alternate location. See the Administrator's Guide for more information.
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
" {} "CREATE DATABASE" {italic} " is a Postgres language extension.
|
||||
|
||||
Use " {} "DROP DATABASE" {italic} " to remove a database. "
|
69
src/bin/pgaccess/lib/help/create_function.hlp
Normal file
@@ -0,0 +1,69 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Synopsis" {bold} "
|
||||
|
||||
CREATE FUNCTION name ( \[ ftype \[, ...\] \] )
|
||||
RETURNS rtype
|
||||
AS definition
|
||||
LANGUAGE 'langname'
|
||||
" {code} "
|
||||
|
||||
name" {italic} "
|
||||
The name of a function to create.
|
||||
|
||||
" {} "ftype" {italic} "
|
||||
The data type of function arguments.
|
||||
|
||||
" {} "rtype" {italic} "
|
||||
The return data type.
|
||||
|
||||
" {} "definition" {italic} "
|
||||
A string defining the function; the meaning depends on the language. It may be an internal function name, the path to an object file, an SQL query, or text in a procedural language.
|
||||
|
||||
" {} "langname" {italic} "
|
||||
may be 'C', 'sql', 'internal' or 'plname', where 'plname' is the name of a created procedural language. See CREATE LANGUAGE for details.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
CREATE
|
||||
This is returned if the command completes successfully.
|
||||
|
||||
CREATE FUNCTION allows a Postgres user to register a function with a database. Subsequently, this user is treated as the owner of the function.
|
||||
|
||||
" {} "Notes:" {italic} "Refer to the chapter on functions in the PostgreSQL Programmer's Guide for further information.
|
||||
|
||||
Use " {} "DROP FUNCTION" {link drop_function} " to drop user-defined functions.
|
||||
|
||||
Postgres allows function \"overloading\"; that is, the same name can be used for several different functions so long as they have distinct argument types. This facility must be used with caution for INTERNAL and C-language functions, however.
|
||||
|
||||
Two INTERNAL functions cannot have the same C name without causing errors at link time. To get around that, give them different C names (for example, use the argument types as part of the C names), then specify those names in the AS clause of CREATE FUNCTION. If the AS clause is left empty then CREATE FUNCTION assumes the C name of the function is the same as the SQL name.
|
||||
|
||||
For dynamically-loaded C functions, the SQL name of the function must be the same as the C function name, because the AS clause is used to give the path name of the object file containing the C code. In this situation it is best not to try to overload SQL function names. It might work to load a C function that has the same C name as an internal function or another dynamically-loaded function --- or it might not. On some platforms the dynamic loader may botch the load in interesting ways if there is a conflict of C function names. So, even if it works for you today, you might regret overloading names later when you try to run the code somewhere else.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
To create a simple SQL function:
|
||||
" {} "
|
||||
CREATE FUNCTION product_price(int4) RETURNS float8 AS
|
||||
'SELECT price FROM products where id = \$1'
|
||||
LANGUAGE 'sql';
|
||||
|
||||
SELECT product_price(314) AS answer;
|
||||
|
||||
answer
|
||||
------
|
||||
15.25
|
||||
" {code} "
|
||||
|
||||
To create a C function, calling a routine from a user-created shared library. This particular routine calculates a check digit and returns TRUE if the check digit in the function parameters is correct. It is intended for use in a CHECK contraint.
|
||||
" {} "
|
||||
CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool
|
||||
AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c';
|
||||
|
||||
CREATE TABLE product (
|
||||
id char(8) PRIMARY KEY,
|
||||
eanprefix char(8) CHECK (eanprefix ~ '\[0-9\]{2}-\[0-9\]{5}')
|
||||
REFERENCES brandname(ean_prefix),
|
||||
eancode char(6) CHECK (eancode ~ '\[0-9\]{6}'),
|
||||
CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode))
|
||||
);
|
||||
" {code}
|
87
src/bin/pgaccess/lib/help/create_index.hlp
Normal file
@@ -0,0 +1,87 @@
|
||||
.pgaw:Help.f.t insert end "CREATE INDEX" {bold} " constructs an index index_name. on the specified table.
|
||||
|
||||
Tip: Indexes are primarily used to enhance database performance. But inappropriate use will result in slower performance.
|
||||
|
||||
In the first syntax shown above, the key fields for the index are specified as column names; a column may also have an associated operator class. An operator class is used to specify the \
|
||||
operators to be used for a particular index. For example, a btree index on four-byte integers would use the int4_ops class; this operator class includes comparison functions for four-byte \
|
||||
integers. The default operator class is the appropriate operator class for that field type.
|
||||
|
||||
In the second syntax, an index is defined on the result of a user-defined function func_name applied to one or more attributes of a single class. These functional indexes can be used to obtain \
|
||||
fast access to data based on operators that would normally require some transformation to apply them to the base data.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE \[ UNIQUE \] INDEX index_name
|
||||
ON table \[ USING acc_name \]
|
||||
( column \[ ops_name\] \[, ...\] )
|
||||
CREATE \[ UNIQUE \] INDEX index_name
|
||||
ON table \[ USING acc_name \]
|
||||
( func_name( column \[, ... \]) ops_name )
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "UNIQUE" {italic} "
|
||||
Causes the system to check for duplicate values in the table when the index is created \
|
||||
\(if data already exist\) and each time data is added. Attempts to insert or update non-duplicate \
|
||||
data will generate an error.
|
||||
|
||||
" {} "index_name" {italic} "
|
||||
The name of the index to be created.
|
||||
|
||||
" {} "table" {italic} "
|
||||
The name of the table to be indexed.
|
||||
|
||||
" {} "acc_name" {italic} "
|
||||
the name of the access method which is to be used for the index. The default access method is BTREE. Postgres provides three access methods for secondary indexes:
|
||||
|
||||
BTREE
|
||||
|
||||
an implementation of the Lehman-Yao high-concurrency btrees.
|
||||
|
||||
RTREE
|
||||
|
||||
implements standard rtrees using Guttman's quadratic split algorithm.
|
||||
|
||||
HASH
|
||||
|
||||
an implementation of Litwin's linear hashing.
|
||||
|
||||
" {} "column" {italic} "
|
||||
The name of a column of the table.
|
||||
|
||||
" {} "ops_name" {italic} "
|
||||
An associated operator class. The following select list returns all ops_names:
|
||||
" {} "
|
||||
SELECT am.amname AS acc_name,
|
||||
opc.opcname AS ops_name,
|
||||
opr.oprname AS ops_comp
|
||||
FROM pg_am am, pg_amop amop,
|
||||
pg_opclass opc, pg_operator opr
|
||||
WHERE amop.amopid = am.oid AND
|
||||
amop.amopclaid = opc.oid AND
|
||||
amop.amopopr = opr.oid
|
||||
ORDER BY acc_name, ops_name, ops_comp
|
||||
|
||||
" {code} "func_name" {italic} "
|
||||
A user-defined function, which returns a value that can be indexed.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "CREATE" {italic} "
|
||||
The message returned if the index is successfully created.
|
||||
|
||||
" {} "ERROR: Cannot create index: 'index_name' already exists." {italic} "
|
||||
This error occurs if it is impossible to create the index.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
To create a btree index on the field title in the table films:
|
||||
" {} "
|
||||
CREATE UNIQUE INDEX title_idx
|
||||
ON films (title);
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Currently, only the BTREE access method supports multi-column indexes. Up to 7 keys may be specified.
|
||||
|
||||
Use DROP INDEX to remove an index. "
|
130
src/bin/pgaccess/lib/help/create_language.hlp
Normal file
@@ -0,0 +1,130 @@
|
||||
.pgaw:Help.f.t insert end "CREATE LANGUAGE" {bold} ". Using CREATE LANGUAGE, a Postgres user can register a new language with Postgres. Subsequently, functions and trigger procedures can be defined in this new language. The user must \
|
||||
have the Postgres superuser privilege to register a new language.
|
||||
|
||||
Writing PL handlers
|
||||
|
||||
The call handler for a procedural language must be written in a compiler language such as 'C' and registered with Postgres as a function taking no arguments and returning the opaque type, a \
|
||||
placeholder for unspecified or undefined types.. This prevents the call handler from being called directly as a function from queries.
|
||||
However, arguments must be supplied on the actual call when a PL function or trigger procedure in the language offered by the handler is to be executed. \
|
||||
When called from the trigger manager, the only argument is the object ID from the procedure's pg_proc entry. All other information from the trigger manager is found in the global \
|
||||
CurrentTriggerData pointer.
|
||||
When called from the function manager, the arguments are the object ID of the procedure's pg_proc entry, the number of arguments given to the PL function, the arguments in a \
|
||||
FmgrValues structure and a pointer to a boolean where the function tells the caller if the return value is the SQL NULL value.
|
||||
|
||||
It's up to the call handler to fetch the pg_proc entry and to analyze the argument and return types of the called procedure. The AS clause from the CREATE FUNCTION of the procedure will \
|
||||
be found in the prosrc attribute of the pg_proc table entry. This may be the source text in the procedural language itself (like for PL/Tcl), a pathname to a file or anything else that tells the call \
|
||||
handler what to do in detail.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE \[ TRUSTED \] PROCEDURAL LANGUAGE 'langname'
|
||||
HANDLER call_handler
|
||||
LANCOMPILER 'comment'
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "TRUSTED" {italic} "
|
||||
TRUSTED specifies that the call handler for the language is safe; that is, it offers an unprivileged user no functionality to bypass access restrictions. If this keyword is omitted when
|
||||
registering the language, only users with the Postgres superuser privilege can use this language to create new functions (like the 'C' language).
|
||||
|
||||
" {} "langname" {italic} "
|
||||
The name of the new procedural language. The language name is case insensitive. A procedural language cannot override one of the built-in languages of Postgres.
|
||||
|
||||
" {} "HANDLER call_handler" {italic} "
|
||||
call_handler is the name of a previously registered function that will be called to execute the PL procedures.
|
||||
|
||||
" {} "comment" {italic} "
|
||||
The LANCOMPILER argument is the string that will be inserted in the LANCOMPILER attribute of the new pg_language entry. At present, Postgres does not use this attribute in any way.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "CREATE" {italic} "
|
||||
This message is returned if the language is successfully created.
|
||||
|
||||
" {} "ERROR: PL handler function funcname\(\) doesn't exist" {italic} "
|
||||
This error is returned if the function funcname() is not found.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
This is a template for a PL handler written in 'C':
|
||||
" {} "
|
||||
#include \"executor/spi.h\"
|
||||
#include \"commands/trigger.h\"
|
||||
#include \"utils/elog.h\"
|
||||
#include \"fmgr.h\" /* for FmgrValues struct */
|
||||
#include \"access/heapam.h\"
|
||||
#include \"utils/syscache.h\"
|
||||
#include \"catalog/pg_proc.h\"
|
||||
#include \"catalog/pg_type.h\"
|
||||
|
||||
Datum
|
||||
plsample_call_handler\(
|
||||
Oid prooid,
|
||||
int pronargs,
|
||||
FmgrValues *proargs,
|
||||
bool *isNull\)
|
||||
\{
|
||||
Datum retval;
|
||||
TriggerData *trigdata;
|
||||
|
||||
if \(CurrentTriggerData == NULL\) \{
|
||||
/*
|
||||
* Called as a function
|
||||
*/
|
||||
|
||||
retval = ...
|
||||
\} else \{
|
||||
/*
|
||||
* Called as a trigger procedure
|
||||
*/
|
||||
trigdata = CurrentTriggerData;
|
||||
CurrentTriggerData = NULL;
|
||||
|
||||
retval = ...
|
||||
\}
|
||||
|
||||
*isNull = false;
|
||||
return retval;
|
||||
\}
|
||||
" {code} "
|
||||
Only a few thousand lines of code have to be added instead of the dots to complete the PL call handler. See CREATE FUNCTION for information on how to compile it into a loadable module .
|
||||
|
||||
The following commands then register the sample procedural language:
|
||||
" {} "
|
||||
CREATE FUNCTION plsample_call_handler () RETURNS opaque
|
||||
AS '/usr/local/pgsql/lib/plsample.so'
|
||||
LANGUAGE 'C';
|
||||
|
||||
CREATE PROCEDURAL LANGUAGE 'plsample'
|
||||
HANDLER plsample_call_handler
|
||||
LANCOMPILER 'PL/Sample';
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Use " {} "CREATE FUNCTION" {bold} " to create a function.
|
||||
|
||||
Use DROP LANGUAGE to drop procedural languages.
|
||||
|
||||
Refer to the table pg_language for further information:
|
||||
|
||||
Table = pg_language
|
||||
" {} "
|
||||
+-----------------+----------+-------+
|
||||
| Field | Type | Length|
|
||||
+-----------------+----------+-------+
|
||||
| lanname | name | 32 |
|
||||
| lancompiler | text | var |
|
||||
+-----------------+----------+-------+
|
||||
|
||||
lanname |lancompiler
|
||||
--------+--------------
|
||||
internal|n/a
|
||||
lisp |/usr/ucb/liszt
|
||||
C |/bin/cc
|
||||
sql |postgres
|
||||
" {code} "
|
||||
|
||||
" {} "Restrictions" {bold} "
|
||||
|
||||
Since the call handler for a procedural language must be registered with Postgres in the 'C' language, it inherits all the capabilities and restrictions of 'C' functions.
|
||||
"
|
145
src/bin/pgaccess/lib/help/create_operator.hlp
Normal file
@@ -0,0 +1,145 @@
|
||||
.pgaw:Help.f.t insert end "CREATE OPERATOR" {bold} " defines a new operator, name. The user who defines an operator becomes its owner.
|
||||
|
||||
The operator name is a sequence of up to thirty two (32) characters in any combination from the following:
|
||||
|
||||
+ - * / < > = ~ ! @ # % ^ & | ` ? $ :
|
||||
" {} "Note:" {bold} " No alphabetic characters are allowed in an operator name. This enables Postgres to parse SQL input into tokens without requiring spaces between each token.
|
||||
|
||||
The operator \"!=\" is mapped to \"<>\" on input, so they are therefore equivalent.
|
||||
|
||||
At least one of LEFTARG and RIGHTARG must be defined. For binary operators, both should be defined. For right unary operators, only LEFTARG should be defined, while for left unary \
|
||||
operators only RIGHTARG should be defined.
|
||||
Also, the func_name procedure must have been previously defined using CREATE FUNCTION and must be defined to accept the correct number of arguments (either one or two). \
|
||||
The commutator operator should be identified if one exists, so that Postgres can reverse the order of the operands if it wishes. For example, the operator area-less-than, <<<, would probably \
|
||||
have a commutator operator, area-greater-than, >>>. Hence, the query optimizer could freely convert:
|
||||
|
||||
\"0,0,1,1\"::box >>> MYBOXES.description
|
||||
to
|
||||
MYBOXES.description <<< \"0,0,1,1\"::box
|
||||
|
||||
This allows the execution code to always use the latter representation and simplifies the query optimizer somewhat.
|
||||
|
||||
Similarly, if there is a negator operator then it should be identified. Suppose that an operator, area-equal, ===, exists, as well as an area not equal, !==. The negator link allows the query \
|
||||
optimizer to simplify
|
||||
|
||||
NOT MYBOXES.description === \"0,0,1,1\"::box
|
||||
to
|
||||
MYBOXES.description !== \"0,0,1,1\"::box
|
||||
|
||||
If a commutator operator name is supplied, Postgres searches for it in the catalog. If it is found and it does not yet have a commutator itself, then the commutator's entry is updated to have the \
|
||||
newly created operator as its commutator. This applies to the negator, as well.
|
||||
|
||||
This is to allow the definition of two operators that are the commutators or the negators of each other. The first operator should be defined without a commutator or negator (as appropriate). \
|
||||
When the second operator is defined, name the first as the commutator or negator. The first will be updated as a side effect.(As of Postgres 6.5, it also works to just have both operators refer to \
|
||||
each other.)
|
||||
|
||||
The next three specifications are present to support the query optimizer in performing joins. Postgres can always evaluate a join (i.e., processing a clause with two tuple variables separated by \
|
||||
an operator that returns a boolean) by iterative substitution \[WONG76\]. In addition, Postgres can use a hash-join algorithm along the lines of \
|
||||
\[SHAP86\]; however, it must know whether this \
|
||||
strategy is applicable. The current hash-join algorithm is only correct for operators that represent equality tests; furthermore, equality of the datatype must mean bitwise equality of the \
|
||||
representation of the type. (For example, a datatype that contains unused bits that don't matter for equality tests could not be hashjoined.) The HASHES flag indicates to the query optimizer \
|
||||
that a hash join may safely be used with this operator.
|
||||
|
||||
Similarly, the two sort operators indicate to the query optimizer whether merge-sort is a usable join strategy and which operators should be used to sort the two operand classes. Sort operators \
|
||||
should only be provided for an equality operator, and they should refer to less-than operators for the left and right side data types respectively.
|
||||
|
||||
If other join strategies are found to be practical, Postgres will change the optimizer and run-time system to use them and will require additional specification when an operator is defined. \
|
||||
Fortunately, the research community invents new join strategies infrequently, and the added generality of user-defined join strategies was not felt to be worth the complexity involved.
|
||||
|
||||
The last two pieces of the specification are present so the query optimizer can estimate result sizes. If a clause of the form:
|
||||
|
||||
MYBOXES.description <<< \"0,0,1,1\"::box
|
||||
|
||||
is present in the qualification, then Postgres may have to estimate the fraction of the instances in MYBOXES that satisfy the clause. The function res_proc must be a registered function \
|
||||
(meaning it is already defined using CREATE FUNCTION) which accepts arguments of the correct data types and returns a floating point number. The query optimizer simply calls this function, \
|
||||
passing the parameter \"0,0,1,1\" and multiplies the result by the relation size to get the desired expected number of instances.
|
||||
|
||||
Similarly, when the operands of the operator both contain instance variables, the query optimizer must estimate the size of the resulting join. The function join_proc will return another floating \
|
||||
point number which will be multiplied by the cardinalities of the two classes involved to compute the desired expected result size.
|
||||
|
||||
The difference between the function
|
||||
|
||||
my_procedure_1 (MYBOXES.description, \"0,0,1,1\"::box)
|
||||
|
||||
and the operator
|
||||
|
||||
MYBOXES.description === \"0,0,1,1\"::box
|
||||
|
||||
is that Postgres attempts to optimize operators and can decide to use an index to restrict the search space when operators are involved. However, there is no attempt to optimize functions, and \
|
||||
they are performed by brute force. Moreover, functions can have any number of arguments while operators are restricted to one or two.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE OPERATOR name (
|
||||
PROCEDURE = func_name
|
||||
\[, LEFTARG = type1 \]
|
||||
\[, RIGHTARG = type2 \]
|
||||
\[, COMMUTATOR = com_op \]
|
||||
\[, NEGATOR = neg_op \]
|
||||
\[, RESTRICT = res_proc \]
|
||||
\[, JOIN = join_proc \]
|
||||
\[, HASHES \]
|
||||
\[, SORT1 = left_sort_op \]
|
||||
\[, SORT2 = right_sort_op \]
|
||||
)
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "name" {italic} "
|
||||
The operator to be defined. See below for allowable characters.
|
||||
|
||||
" {} "func_name" {italic} "
|
||||
The function used to implement this operator.
|
||||
|
||||
" {} "type1" {italic} "
|
||||
The type for the left-hand side of the operator, if any. This option would be omitted for a right-unary operator.
|
||||
|
||||
" {} "type2" {italic} "
|
||||
The type for the right-hand side of the operator, if any. This option would be omitted for a left-unary operator.
|
||||
|
||||
" {} "com_op" {italic} "
|
||||
The commutator for this operator.
|
||||
|
||||
" {} "neg_op" {italic} "
|
||||
The negator of this operator.
|
||||
|
||||
" {} "res_proc" {italic} "
|
||||
The restriction selectivity estimator function for this operator.
|
||||
|
||||
" {} "join_proc" {italic} "
|
||||
The join selectivity estimator function for this operator.
|
||||
|
||||
" {} "HASHES" {italic} "
|
||||
Indicates this operator can support a hash-join algorithm.
|
||||
|
||||
" {} "left_sort_op" {italic} "
|
||||
Operator that sorts the left-hand data type of this operator.
|
||||
|
||||
" {} "right_sort_op" {italic} "
|
||||
Operator that sorts the right-hand data type of this operator.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "CREATE" {italic} "
|
||||
Message returned if the operator is successfully created.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
The following command defines a new operator, area-equality, for the BOX data type.
|
||||
" {} "
|
||||
CREATE OPERATOR === (
|
||||
LEFTARG = box,
|
||||
RIGHTARG = box,
|
||||
PROCEDURE = area_equal_procedure,
|
||||
COMMUTATOR = ===,
|
||||
NEGATOR = !==,
|
||||
RESTRICT = area_restriction_procedure,
|
||||
JOIN = area_join_procedure,
|
||||
HASHES,
|
||||
SORT1 = <<<,
|
||||
SORT2 = <<<)
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Refer to the chapter on operators in the PostgreSQL User's Guide for further information. Refer to DROP OPERATOR to delete user-defined operators from a database.
|
||||
"
|
132
src/bin/pgaccess/lib/help/create_rule.hlp
Normal file
@@ -0,0 +1,132 @@
|
||||
.pgaw:Help.f.t insert end "CREATE RULE" {bold} " The semantics of a rule is that at the time an individual instance is accessed, updated, inserted or deleted, there is a current instance (for retrieves, updates and deletes) and a new instance (for \
|
||||
updates and appends). If the event specified in the ON clause and the condition specified in the WHERE clause are true for the current instance, the action part of the rule is executed. First, \
|
||||
however, values from fields in the current instance and/or the new instance are substituted for current.attribute-name and new.attribute-name.
|
||||
|
||||
The action part of the rule executes with the same command and transaction identifier as the user command that caused activation.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE RULE name
|
||||
AS ON event
|
||||
TO object \[ WHERE condition \]
|
||||
DO \[ INSTEAD \] \[ action | NOTHING \]
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "name" {italic} "
|
||||
The name of a rule to create.
|
||||
|
||||
" {} "event" {italic} "
|
||||
Event is one of select, update, delete or insert.
|
||||
|
||||
" {} "object" {italic} "
|
||||
Object is either table or table.column.
|
||||
|
||||
" {} "condition" {italic} "
|
||||
Any SQL WHERE clause. new or current can appear instead of an instance variable whenever an instance variable is permissible in SQL.
|
||||
|
||||
" {} "action" {italic} "
|
||||
Any SQL statement. new or current can appear instead of an instance variable whenever an instance variable is permissible in SQL.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "CREATE" {italic} "
|
||||
Message returned if the rule is successfully created.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
Make Sam get the same salary adjustment as Joe:
|
||||
" {} "
|
||||
create rule example_1 as
|
||||
on update EMP.salary where current.name = \"Joe\"
|
||||
do update EMP (salary = new.salary)
|
||||
where EMP.name = \"Sam\"
|
||||
|
||||
" {code} "
|
||||
At the time Joe receives a salary adjustment, the event will become true and Joe's current instance and proposed new instance are available to the execution routines. Hence, his new salary is \
|
||||
substituted into the action part of the rule which is subsequently executed. This propagates Joe's salary on to Sam.
|
||||
|
||||
Make Bill get Joe's salary when it is accessed:
|
||||
" {} "
|
||||
create rule example_2 as
|
||||
on select to EMP.salary
|
||||
where current.name = \"Bill\"
|
||||
do instead
|
||||
select (EMP.salary) from EMP
|
||||
where EMP.name = \"Joe\"
|
||||
|
||||
" {code} "
|
||||
Deny Joe access to the salary of employees in the shoe department (current_user returns the name of the current user):
|
||||
|
||||
" {} "
|
||||
create rule example_3 as
|
||||
on select to EMP.salary
|
||||
where current.dept = \"shoe\" and current_user = \"Joe\"
|
||||
do instead nothing
|
||||
|
||||
" {code} "
|
||||
Create a view of the employees working in the toy department.
|
||||
" {} "
|
||||
create TOYEMP(name = char16, salary = int4)
|
||||
|
||||
create rule example_4 as
|
||||
on select to TOYEMP
|
||||
do instead
|
||||
select (EMP.name, EMP.salary) from EMP
|
||||
where EMP.dept = \"toy\"
|
||||
|
||||
" {code} "
|
||||
All new employees must make 5,000 or less
|
||||
" {} "
|
||||
create rule example_5 as
|
||||
on insert to EMP where new.salary > 5000
|
||||
do update newset salary = 5000
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
A caution about SQL rules is in order. If the same class name or instance variable appears in the event, the condition and the action parts of a rule, they are all considered different tuple \
|
||||
variables. More accurately, new and current are the only tuple variables that are shared between these clauses. For example, the following two rules have the same semantics:
|
||||
" {} "
|
||||
on update to EMP.salary where EMP.name = \"Joe\"
|
||||
do update EMP ( ... ) where ...
|
||||
|
||||
on update to EMP-1.salary where EMP-2.name = \"Joe\"
|
||||
do update EMP-3 ( ... ) where ...
|
||||
|
||||
" {code} "
|
||||
Each rule can have the optional tag INSTEAD. Without this tag, action will be performed in addition to the user command when the event in the condition part of the rule occurs. Alternately, \
|
||||
the action part will be done instead of the user command. In this later case, the action can be the keyword NOTHING.
|
||||
|
||||
When choosing between the rewrite and instance rule systems for a particular rule application, remember that in the rewrite system, current refers to a relation and some qualifiers whereas in \
|
||||
the instance system it refers to an instance (tuple).
|
||||
|
||||
It is very important to note that the rewrite rule system will neither detect nor process circular rules. For example, though each of the following two rule definitions are accepted by Postgres, the \
|
||||
retrieve command will cause Postgres to crash:
|
||||
|
||||
Example 14-1. Example of a circular rewrite rule combination.
|
||||
" {} "
|
||||
create rule bad_rule_combination_1 as
|
||||
on select to EMP
|
||||
do instead select to TOYEMP
|
||||
|
||||
create rule bad_rule_combination_2 as
|
||||
on select to TOYEMP
|
||||
do instead select to EMP
|
||||
|
||||
" {code} "
|
||||
This attempt to retrieve from EMP will cause Postgres to crash.
|
||||
" {} "
|
||||
select * from EMP
|
||||
|
||||
" {code} "
|
||||
You must have rule definition access to a class in order to define a rule on it. Use GRANT and REVOKE to change permissions.
|
||||
|
||||
" {} "Bugs" {bold} "
|
||||
|
||||
The object in a SQL rule cannot be an array reference and cannot have parameters.
|
||||
|
||||
Aside from the \"oid\" field, system attributes cannot be referenced anywhere in a rule. Among other things, this means that functions of instances (e.g., \"foo(emp)\" where \
|
||||
\"emp\" is a class) cannot be called anywhere in a rule.
|
||||
|
||||
The rule system stores the rule text and query plans as text attributes. This implies that creation of rules may fail if the rule plus its various internal representations exceed some value that is on \
|
||||
the order of one page (8KB). "
|
42
src/bin/pgaccess/lib/help/create_sequence.hlp
Normal file
@@ -0,0 +1,42 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"CREATE SEQUENCE" {bold} " will enter a new sequence number generator into the current data base. This involves creating and initialising a new single-row table with the name seqname. The generator will be \"owned\" by the user issuing the command.
|
||||
|
||||
After a sequence is created, you may use the function nextval(seqname) to get a new number from the sequence. The function currval('seqname') may be used to determine the number returned by the last call to nextval(seqname) for the specified sequence in the current session. The function setval('seqname', newvalue) may be used to set the current value of the specified sequence. The next call to nextval(seqname) will return the given value plus the sequence increment.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE SEQUENCE seqname
|
||||
\[ INCREMENT increment \]
|
||||
\[ MINVALUE minvalue \]
|
||||
\[ MAXVALUE maxvalue \]
|
||||
\[ START start \]
|
||||
\[ CACHE cache \]
|
||||
\[ CYCLE \]
|
||||
" {code} "
|
||||
" {} "Inputs" {bold} "
|
||||
|
||||
" {} "seqname" {italic} "
|
||||
The name of a sequence to be created.
|
||||
|
||||
" {} "increment" {italic} "
|
||||
The INCREMENT increment clause is optional. A positive value will make an ascending sequence, a negative one a descending sequence. The default value is one (1).
|
||||
|
||||
" {} "minvalue" {italic} "
|
||||
The optional clause MINVALUE minvalue determines the minimum value a sequence can generate. The defaults are 1 and -2147483647 for ascending and descending sequences, respectively.
|
||||
|
||||
" {} "maxvalue" {italic} "
|
||||
Use the optional clause MAXVALUE maxvalue to determine the maximum value for the sequence. The defaults are 2147483647 and -1 for ascending and descending sequences, respectively.
|
||||
|
||||
" {} "start" {italic} "
|
||||
The optional START start clause enables the sequence to begin anywhere. The default starting value is minvalue for ascending sequences and maxvalue for descending ones.
|
||||
|
||||
" {} "cache" {italic} "
|
||||
The CACHE cache option enables sequence numbers to be preallocated and stored in memory for faster access. The minimum value is 1 (only one value can be generated at a time, i.e. no cache) and this is also the default.
|
||||
|
||||
" {} "CYCLE" {italic} "
|
||||
The optional CYCLE keyword may be used to enable the sequence to continue when the maxvalue or minvalue has been reached by an ascending or descending sequence respectively. If the limit is reached, the next number generated will be whatever the minvalue or maxvalue is, as appropriate.
|
||||
|
||||
" {} "CAUTION" {title} "
|
||||
Unexpected results may be obtained if a cache setting greater than one is used for a sequence object that will be used concurrently by multiple backends. Each backend will allocate \"cache\" successive sequence values during one access to the sequence object and increase the sequence object's last_value accordingly. Then, the next cache-1 uses of nextval within that backend simply return the preallocated values without touching the shared object. So, numbers allocated but not used in the current session will be lost. Furthermore, although multiple backends are guaranteed to allocate distinct sequence values, the values may be generated out of sequence when all the backends are considered. (For example, with a cache setting of 10, backend A might reserve values 1..10 and return nextval=1, then backend B might reserve values 11..20 and return nextval=11 before backend A has generated nextval=2.) Thus, with a cache setting of one it is safe to assume that nextval values are generated sequentially; with a cache setting greater than one you should only assume that the nextval values are all distinct, not that they are generated purely sequentially. Also, last_value will reflect the latest value reserved by any backend, whether or not it has yet been returned by nextval.
|
||||
|
||||
CREATE SEQUENCE is a Postgres language extension. There is no CREATE SEQUENCE statement in SQL92."
|
39
src/bin/pgaccess/lib/help/create_table.hlp
Normal file
@@ -0,0 +1,39 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"CREATE TABLE" {bold} "
|
||||
|
||||
CREATE \[ TEMPORARY | TEMP \] TABLE table (
|
||||
column type
|
||||
\[ NULL | NOT NULL \] \[ UNIQUE \] \[ DEFAULT value \]
|
||||
\[column_constraint_clause | PRIMARY KEY } \[ ... \] \]
|
||||
\[, ... ]
|
||||
\[, PRIMARY KEY ( column \[, ...\] ) \]
|
||||
\[, CHECK ( condition ) \]
|
||||
\[, table_constraint_clause \]
|
||||
) \[ INHERITS ( inherited_table \[, ...\] ) \]
|
||||
" {code} "
|
||||
TEMPORARY
|
||||
The table is created only for this session, and is automatically dropped on session exit. Existing permanent tables with the same name are not visible while the temporary table exists.
|
||||
" {} "
|
||||
table" {italic} "
|
||||
The name of a new table to be created.
|
||||
" {} "
|
||||
column" {italic} "
|
||||
The name of a column.
|
||||
" {} "
|
||||
type" {italic} "
|
||||
The type of the column. This may include array specifiers. Refer to the PostgreSQL User's Guide for further information about data types and arrays.
|
||||
" {} "
|
||||
DEFAULT value" {italic} "
|
||||
A default value for a column. See the DEFAULT clause for more information.
|
||||
" {} "
|
||||
column_constraint_clause" {italic} "
|
||||
The optional column constraint clauses specify a list of integrity constraints or tests which new or updated entries must satisfy for an insert or update operation to succeed. Each constraint must evaluate to a boolean expression. Although SQL92 requires the column_constraint_clause to refer to that column only, Postgres allows multiple columns to be referenced within a single column constraint. See the column constraint clause for more information.
|
||||
" {} "
|
||||
table_constraint_clause" {italic} "
|
||||
The optional table CONSTRAINT clause specifies a list of integrity constraints which new or updated entries must satisfy for an insert or update operation to succeed. Each constraint must evaluate to a boolean expression. Multiple columns may be referenced within a single constraint. Only one PRIMARY KEY clause may be specified for a table; PRIMARY KEY column (a table constraint) and PRIMARY KEY (a column constraint) are mutually exclusive.. See the table constraint clause for more information.
|
||||
" {} "
|
||||
INHERITS inherited_table" {italic} "
|
||||
The optional INHERITS clause specifies a collection of table names from which this table automatically inherits all fields. If any inherited field name appears more than once, Postgres reports an error. Postgres automatically allows the created table to inherit functions on tables above it in the inheritance hierarchy.
|
||||
|
||||
Aside: Inheritance of functions is done according to the conventions of the Common Lisp Object System (CLOS).
|
||||
"
|
20
src/bin/pgaccess/lib/help/create_table_as.hlp
Normal file
@@ -0,0 +1,20 @@
|
||||
.pgaw:Help.f.t insert end "CREATE TABLE AS" {bold} " CREATE TABLE AS enables a table to be created from the contents of an existing table. It has functionality equivalent to SELECT TABLE INTO, but with perhaps a more obvious syntax.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
CREATE TABLE table \[ (column \[, ...\] ) \]
|
||||
AS select_clause
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "table" {italic} "
|
||||
The name of a new table to be created.
|
||||
|
||||
" {} "column" {italic} "
|
||||
The name of a column. Multiple column names can be specified using a comma-delimited list of column names.
|
||||
|
||||
" {} "select_clause" {italic} "
|
||||
A valid query statement. Refer to SELECT for a description of the allowed syntax.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
Refer to CREATE TABLE and SELECT for a summary of possible output messages. "
|
80
src/bin/pgaccess/lib/help/create_trigger.hlp
Normal file
@@ -0,0 +1,80 @@
|
||||
.pgaw:Help.f.t insert end "CREATE TRIGGER" {bold} " will enter a new trigger into the current data base. The trigger will be associated with the relation relname and will execute the specified function funcname.
|
||||
|
||||
The trigger can be specified to fire either before the operation is attempted on a tuple (before constraints are checked and the INSERT, UPDATE or DELETE is attempted) or after the operation \
|
||||
has been attempted (e.g. after constraints are checked and the INSERT, UPDATE or DELETE has completed). If the trigger fires before the event, the trigger may skip the operation for the \
|
||||
current tuple, or change the tuple being inserted (for INSERT and UPDATE operations only). If the trigger fires after the event, all changes, including the last insertion, update, or deletion, are \
|
||||
\"visible\" to the trigger.
|
||||
|
||||
Refer to the chapters on SPI and Triggers in the PostgreSQL Programmer's Guide for more information.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE TRIGGER name \{ BEFORE | AFTER \}
|
||||
\{ event \[OR ...\] \}
|
||||
ON table FOR EACH \{ ROW | STATEMENT \}
|
||||
EXECUTE PROCEDURE funcname ( arguments )
|
||||
|
||||
" {code} "Inputs" {bold} "
|
||||
|
||||
" {} "name" {italic} "
|
||||
The name of an existing trigger.
|
||||
|
||||
" {} "table" {italic} "
|
||||
The name of a table.
|
||||
|
||||
" {} "event" {italic} "
|
||||
One of INSERT, DELETE or UPDATE.
|
||||
|
||||
" {} "funcname" {italic} "
|
||||
A user-supplied function.
|
||||
|
||||
" {} "Outputs" {bold} "
|
||||
|
||||
" {} "CREATE" {italic} "
|
||||
This message is returned if the trigger is successfully created.
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
Check if the specified distributor code exists in the distributors table before appending or updating a row in the table films:
|
||||
" {} "
|
||||
CREATE TRIGGER if_dist_exists
|
||||
BEFORE INSERT OR UPDATE ON films FOR EACH ROW
|
||||
EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
|
||||
|
||||
" {code} "
|
||||
Before cancelling a distributor or updating its code, remove every reference to the table films:
|
||||
" {} "
|
||||
CREATE TRIGGER if_film_exists
|
||||
BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
|
||||
EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');
|
||||
|
||||
|
||||
|
||||
" {code} "Compatibility" {bold} "
|
||||
|
||||
" {} "SQL92" {italic} "
|
||||
|
||||
There is no CREATE TRIGGER in SQL92.
|
||||
|
||||
The second example above may also be done by using a FOREIGN KEY constraint as in:
|
||||
" {} "
|
||||
CREATE TABLE distributors (
|
||||
did DECIMAL(3),
|
||||
name VARCHAR(40),
|
||||
CONSTRAINT if_film_exists
|
||||
FOREIGN KEY(did) REFERENCES films
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
);
|
||||
|
||||
" {code} "
|
||||
However, foreign keys are not yet implemented (as of version 6.4) in Postgres.
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
" {} "CREATE TRIGGER" {italic} " is a Postgres language extension.
|
||||
|
||||
Only the relation owner may create a trigger on this relation.
|
||||
|
||||
As of the current release (v6.4), STATEMENT triggers are not implemented.
|
||||
|
||||
Refer to DROP TRIGGER for information on how to remove triggers. "
|
24
src/bin/pgaccess/lib/help/create_type.hlp
Normal file
@@ -0,0 +1,24 @@
|
||||
.pgaw:Help.f.t insert end "CREATE TYPE" {bold} " allows the user to register a new user data type with Postgres for use in the current data base. The user who defines a type becomes its owner. Typename is the name of the new \
|
||||
type and must be unique within the types defined for this database.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE TYPE typename (
|
||||
INPUT = input_function
|
||||
, OUTPUT = output_function
|
||||
, INTERNALLENGTH = (internallength | VARIABLE)
|
||||
\[ , EXTERNALLENGTH = (externallength | VARIABLE) \]
|
||||
\[ , ELEMENT = element \]
|
||||
\[ , DELIMITER = delimiter \]
|
||||
\[ , DEFAULT = \"default\" \]
|
||||
\[ , SEND = send_function \]
|
||||
\[ , RECEIVE = receive_function \]
|
||||
\[ , PASSEDBYVALUE \]
|
||||
)
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Refer to DROP TYPE to remove an existing type.
|
||||
|
||||
See also CREATE FUNCTION, CREATE OPERATOR and the chapter on Large Objects in the PostgreSQL Programmer's Guide.
|
||||
"
|
50
src/bin/pgaccess/lib/help/create_user.hlp
Normal file
@@ -0,0 +1,50 @@
|
||||
.pgaw:Help.f.t insert end "CREATE USER" {bold} " will add a new user to an instance of Postgres.
|
||||
|
||||
The new user will be given a usesysid of: 'SELECT MAX(usesysid) + 1 FROM pg_shadow'. This means that Postgres users' usesysids will not correspond to their operating system(OS) \
|
||||
user ids. The exception to this rule is the 'postgres' user, whose OS user id is used as the usesysid during the initdb process. If you still want the OS user id and the usesysid to match for any \
|
||||
given user, use the \"createuser\" script provided with the Postgres distribution.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE USER username
|
||||
\[ WITH PASSWORD password \]
|
||||
\[ CREATEDB | NOCREATEDB \]
|
||||
\[ CREATEUSER | NOCREATEUSER \]
|
||||
\[ IN GROUP groupname \[, ...\] \]
|
||||
\[ VALID UNTIL 'abstime' \]
|
||||
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
Create a user with no password:
|
||||
" {} " CREATE USER jonathan
|
||||
" {code} "
|
||||
Create a user with a password:
|
||||
" {} " CREATE USER davide WITH PASSWORD jw8s0F4
|
||||
" {code} "
|
||||
Create a user with a password, whose account is valid until the end of 2001. Note that after one second has ticked in 2002, the account is not valid:
|
||||
" {} " CREATE USER miriam WITH PASSWORD jw8s0F4 VALID UNTIL 'Jan 1 2002'
|
||||
" {code} "
|
||||
Create an account where the user can create databases:
|
||||
" {} " CREATE USER manuel WITH PASSWORD jw8s0F4 CREATEDB
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
CREATE USER statement is a Postgres language extension.
|
||||
Use DROP USER or ALTER USER statements to remove or modify a user account.
|
||||
Refer to the pg_shadow table for further information.
|
||||
" {} "
|
||||
Table = pg_shadow
|
||||
+--------------------------+--------------------------+-------+
|
||||
| Field | Type | Length|
|
||||
+--------------------------+--------------------------+-------+
|
||||
| usename | name | 32 |
|
||||
| usesysid | int4 | 4 |
|
||||
| usecreatedb | bool | 1 |
|
||||
| usetrace | bool | 1 |
|
||||
| usesuper | bool | 1 |
|
||||
| usecatupd | bool | 1 |
|
||||
| passwd | text | var |
|
||||
| valuntil | abstime | 4 |
|
||||
+--------------------------+--------------------------+-------+
|
||||
" {code}
|
27
src/bin/pgaccess/lib/help/create_view.hlp
Normal file
@@ -0,0 +1,27 @@
|
||||
.pgaw:Help.f.t insert end "CREATE VIEW" {bold} " will define a view of a table. This view is not physically materialized. Specifically, a query rewrite retrieve rule is automatically generated to support retrieve operations on \
|
||||
views.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
CREATE VIEW view
|
||||
AS SELECT query
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
Create a view consisting of all Comedy films:
|
||||
" {} "
|
||||
CREATE VIEW kinds AS
|
||||
SELECT *
|
||||
FROM films
|
||||
WHERE kind = 'Comedy';
|
||||
|
||||
SELECT * FROM kinds;
|
||||
|
||||
code |title |did| date_prod|kind |len
|
||||
-----+-------------------------+---+----------+----------+------
|
||||
UA502|Bananas |105|1971-07-13|Comedy | 01:22
|
||||
C_701|There's a Girl in my Soup|107|1970-06-11|Comedy | 01:36
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Use the DROP VIEW statement to drop views. "
|
48
src/bin/pgaccess/lib/help/data_types.hlp
Normal file
@@ -0,0 +1,48 @@
|
||||
.pgaw:Help.f.t configure -tabs {130 300 450}
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Data types\n\n" {title} \
|
||||
"Postgres has a rich set of native data types available to users. Users may add new types to Postgres using the DEFINE TYPE command described elsewhere.
|
||||
|
||||
In the context of data types, the following sections will discuss SQL standards compliance, porting issues, and usage. Some Postgres types correspond directly to SQL92-compatible types. In other cases, data types defined by SQL92 syntax are mapped directly into native Postgres types. Many of the built-in types have obvious external formats. However, several types are either unique to Postgres, such as open and closed paths, or have several possibilities for formats, such as the date and time types.
|
||||
|
||||
" {} \
|
||||
"Postgres Type\tSQL92 or SQL3 Type\tDescription\n" {bold} \
|
||||
"bool\tboolean\tlogical boolean (true/false)
|
||||
box\t\trectangular box in 2D plane\tchar(n)
|
||||
character(n)\t\tfixed-length character string
|
||||
cidr\t\tIP version 4 network or host address
|
||||
circle\t\tcircle in 2D plane
|
||||
date\tdate\tcalendar date without time of day
|
||||
float4/8\tfloat(p)\tfloating-point number with precision p
|
||||
float8\treal, double precision\tdouble-precision floating-point number
|
||||
inet\t\tIP version 4 network or host address
|
||||
int2\tsmallint\tsigned two-byte integer
|
||||
int4\tint, integer\tsigned 4-byte integer
|
||||
int4\tdecimal(p,s)\texact numeric for p <= 9, s = 0
|
||||
int4\tnumeric(p,s)\texact numeric for p == 9, s = 0
|
||||
int8\t\tsigned 8-byte integer
|
||||
line\t\tinfinite line in 2D plane
|
||||
lseg\t\tline segment in 2D plane
|
||||
money\tdecimal(9,2)\tUS-style currency
|
||||
path\t\topen and closed geometric path in 2D plane
|
||||
point\t\tgeometric point in 2D plane
|
||||
polygon\t\tclosed geometric path in 2D plane
|
||||
serial\t\tunique id for indexing and cross-reference
|
||||
time\ttime\ttime of day
|
||||
timespan\tinterval\tgeneral-use time span
|
||||
timestamp\ttimestamp with time zone\tdate/time
|
||||
varchar(n)\tcharacter varying(n)\tvariable-length character string
|
||||
|
||||
Note: The cidr and inet types are designed to handle any IP type but only ipv4 is handled in the current implementation. Everything here that talks about ipv4 will apply to ipv6 in a future release.
|
||||
|
||||
" {} \
|
||||
"Postgres Function Constants
|
||||
|
||||
Postgres Function\tSQL92 Constant\tDescription" {bold} \
|
||||
"
|
||||
getpgusername()\tcurrent_user\tuser name in current session
|
||||
date('now')\tcurrent_date\tdate of current transaction
|
||||
time('now')\tcurrent_time\ttime of current transaction
|
||||
timestamp('now')\tcurrent_timestamp\tdate and time of current transaction
|
||||
" {}
|
||||
|
58
src/bin/pgaccess/lib/help/datefunc.hlp
Normal file
@@ -0,0 +1,58 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"DateTime functions\n\n" {title} \
|
||||
"abstime(datetime) " {bold} "
|
||||
Returns: abstime
|
||||
convert to abstime
|
||||
|
||||
" {} "age(datetime,datetime) " {bold} "
|
||||
Returns: timespan
|
||||
preserve months and years
|
||||
|
||||
" {} "datetime(abstime) " {bold} "
|
||||
Returns: datetime
|
||||
convert to datetime
|
||||
|
||||
" {} "datetime(date) " {bold} "
|
||||
Returns: datetime
|
||||
convert to datetime
|
||||
|
||||
" {} "datetime(date,time) " {bold} "
|
||||
Returns: datetime
|
||||
convert to datetime
|
||||
|
||||
" {} "date_part(text,datetime) " {bold} "
|
||||
Returns: float8
|
||||
portion of date
|
||||
|
||||
" {} "date_part(text,timespan) " {bold} "
|
||||
Returns: float8
|
||||
portion of time
|
||||
|
||||
" {} "date_trunc(text,datetime) " {bold} "
|
||||
Returns: datetime
|
||||
truncate date
|
||||
|
||||
" {} "isfinite(abstime) " {bold} "
|
||||
Returns: bool
|
||||
a finite time?
|
||||
|
||||
" {} "isfinite(datetime) " {bold} "
|
||||
Returns: bool
|
||||
a finite time?
|
||||
|
||||
" {} "isfinite(timespan) " {bold} "
|
||||
Returns: bool
|
||||
a finite time?
|
||||
|
||||
" {} "reltime(timespan) " {bold} "
|
||||
Returns: reltime
|
||||
convert to reltime
|
||||
|
||||
" {} "timespan(reltime) " {bold} "
|
||||
Returns: timespan
|
||||
convert to timespan
|
||||
|
||||
|
||||
" {} \
|
||||
"PostgreSQL functions\n" {link pgfunctions} \
|
||||
"Next - geometric functions" {link geomfunc}
|
29
src/bin/pgaccess/lib/help/declare.hlp
Normal file
@@ -0,0 +1,29 @@
|
||||
.pgaw:Help.f.t insert end "DECLARE" {bold} " allows a user to create cursors, which can be used to retrieve a small number of rows at a time out of a larger query. Cursors can return data either in text or in binary foramt.
|
||||
|
||||
Normal cursors return data in text format, either ASCII or another encoding scheme depending on how the Postgres backend was built. Since data is stored natively in binary format, the system \
|
||||
must do a conversion to produce the text format. In addition, text formats are often larger in size than the corresponding binary format. Once the information comes back in text form, the client \
|
||||
application may have to convert it to a binary format to manipulate it anyway.
|
||||
|
||||
BINARY cursors give you back the data in the native binary representation. So binary cursors will tend to be a little faster since they suffer less conversion overhead.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DECLARE cursor \[ BINARY \] \[ INSENSITIVE \] \[ SCROLL \]
|
||||
CURSOR FOR query
|
||||
\[ FOR \[ READ ONLY | UPDATE \[ OF column \[, ...\] \] \]
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
To declare a cursor:
|
||||
" {} "
|
||||
DECLARE liahona CURSOR
|
||||
FOR SELECT * FROM films;
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Cursors are only available in transactions.
|
||||
|
||||
Postgres does not have an explicit OPEN cursor statement; a cursor is considered to be open when it is declared.
|
||||
|
||||
Note: In SQL92 cursors are only available in embedded applications. ecpg, the embedded SQL preprocessor for Postgres, supports the SQL92 conventions, including those \
|
||||
involving DECLARE and OPEN statements. "
|
43
src/bin/pgaccess/lib/help/delete.hlp
Normal file
@@ -0,0 +1,43 @@
|
||||
.pgaw:Help.f.t insert end "DELETE" {bold} " emoves rows which satisfy the WHERE condition, from the specified table. \
|
||||
If the condition is absent, the effect is to delete all rows in the table. The result is a valid, but empty table. \
|
||||
You must have write access to the table in order to modify it, as well as read access to any table whose values are read in the condition.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
DELETE FROM table \[ WHERE condition \]
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
Remove all films but musicals:
|
||||
" {} "
|
||||
DETETE FROM films WHERE kind <> 'Musical';
|
||||
|
||||
SELECT * FROM films;
|
||||
|
||||
code |title |did| date_prod|kind |len
|
||||
-----+-------------------------+---+----------+----------+------
|
||||
UA501|West Side Story |105|1961-01-03|Musical | 02:32
|
||||
TC901|The King and I |109|1956-08-11|Musical | 02:13
|
||||
WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
|
||||
(3 rows)
|
||||
|
||||
|
||||
Clear the table films:
|
||||
|
||||
DELETE FROM films;
|
||||
|
||||
SELECT * FROM films;
|
||||
code|title|did|date_prod|kind|len
|
||||
----+-----+---+---------+----+---
|
||||
(0 rows)
|
||||
|
||||
" {code} "Compatibility" {bold} "
|
||||
|
||||
SQL92
|
||||
|
||||
SQL92 allows a positioned DELETE statement:
|
||||
|
||||
DELETE FROM table WHERE CURRENT OF cursor
|
||||
|
||||
|
||||
where cursor identifies an open cursor. Interactive cursors in Postgres are read-only. "
|
17
src/bin/pgaccess/lib/help/drop_aggregate.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP AGGREGATE" {bold} " will remove all references to an existing aggregate definition. To execute this command the current user must be the owner of the aggregate.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP AGGREGATE name type
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
To remove the myavg aggregate for type int4:
|
||||
|
||||
DROP AGGREGATE myavg int4;
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
The DROP AGGREGATE statement is a Postgres language extension.
|
||||
|
||||
Refer to the CREATE AGGREGATE statement to create aggregate functions. "
|
14
src/bin/pgaccess/lib/help/drop_database.hlp
Normal file
@@ -0,0 +1,14 @@
|
||||
.pgaw:Help.f.t insert end "DROP DATABASE" {bold} " removes the catalog entries for an existing database and deletes the directory containing the data. It can only be executed by the database administrator (See the \
|
||||
CREATE DATABASE command for details).
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP DATABASE name
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
DROP DATABASE statement is a Postgres language extension.
|
||||
|
||||
Tip: This query cannot be executed while connected to the target database. It is usually preferable to use the destroydb script instead.
|
||||
|
||||
Refer to the CREATE DATABASE statement for information on how to create a database. "
|
22
src/bin/pgaccess/lib/help/drop_function.hlp
Normal file
@@ -0,0 +1,22 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"DROP FUNCTION" {bold} " will remove references to an existing C function. To execute this command the user must be the owner of the function. The input argument types to the function must be specified, as only the function with the given name and argument types will be removed.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP FUNCTION name ( \[ type \[, ...\] \] )
|
||||
" {code} "
|
||||
Inputs
|
||||
" {} "name" {italic} "
|
||||
The name of an existing function.
|
||||
|
||||
" {} "type" {italic} "
|
||||
The type of function parameters.
|
||||
|
||||
Outputs
|
||||
" {} "DROP" {code} "
|
||||
|
||||
Message returned if the command completes successfully.
|
||||
|
||||
WARN RemoveFunction: Function \"name\" (\"types\") does not exist
|
||||
|
||||
This message is given if the function specified does not exist in the current database."
|
17
src/bin/pgaccess/lib/help/drop_index.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP INDEX" {bold} " drops an existing index from the database system. To execute this command you must be the owner of the index.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP INDEX index_name
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
This command will remove the title_idx index:
|
||||
" {} "
|
||||
DROP INDEX title_idx;
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
DROP INDEX is a Postgres language extension.
|
||||
|
||||
Refer to the CREATE INDEX statement for information on how to create indexes. "
|
17
src/bin/pgaccess/lib/help/drop_language.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP LANGUAGE" {bold} " will remove the definition of the previously registered procedural language having the name 'langname'.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP PROCEDURAL LANGUAGE 'langname'
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
This command removes the PL/Sample language:
|
||||
" {} "
|
||||
DROP PROCEDURAL LANGUAGE 'plsample'
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
The DROP PROCEDURAL LANGUAGE statement is a Postgres language extension.
|
||||
|
||||
Refer to CREATE PROCEDURAL LANGUAGE for information on how to create procedural languages. "
|
32
src/bin/pgaccess/lib/help/drop_operator.hlp
Normal file
@@ -0,0 +1,32 @@
|
||||
.pgaw:Help.f.t insert end "DROP OPERATOR" {bold} " The DROP OPERATOR statement drops an existing operator from the database. To execute this command you must be the owner of the operator. \
|
||||
The left or right type of a left or right unary operator, respectively, may be specified as NONE.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
DROP OPERATOR id ( type | NONE \[,...\] )
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
Remove power operator a^n for int4:
|
||||
" {} "
|
||||
DROP OPERATOR ^ (int4, int4);
|
||||
|
||||
" {code} "
|
||||
Remove left unary operator !a for booleans:
|
||||
" {} "
|
||||
DROP OPERATOR ! (none, bool);
|
||||
|
||||
" {code} "
|
||||
Remove right unary factorial operator a! for int4:
|
||||
" {} "
|
||||
DROP OPERATOR ! (int4, none);
|
||||
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
The DROP OPERATOR statement is a Postgres language extension.
|
||||
|
||||
Refer to CREATE OPERATOR for information on how to create operators.
|
||||
|
||||
It is the user's responsibility to remove any access methods and operator classes that rely on the deleted operator.
|
||||
"
|
17
src/bin/pgaccess/lib/help/drop_rule.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP RULE" {bold} " drops a rule from the specified Postgres rule system. Postgres will immediately cease enforcing it and will purge its definition from the system catalogs.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP RULE name
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
To drop the rewrite rule newrule:
|
||||
|
||||
DROP RULE newrule
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
The DROP RULE statement is a Postgres language extension.
|
||||
|
||||
Refer to CREATE RULE for information on how to create rules. "
|
17
src/bin/pgaccess/lib/help/drop_sequence.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP SEQUENCE" {bold} " removes sequence number generators from the data base. With the current implementation of sequences as special tables it works just like the DROP TABLE statement.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
DROP SEQUENCE seqname \[, ...\]
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
To remove sequence serial from database:
|
||||
|
||||
DROP SEQUENCE serial
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
The DROP SEQUENCE statement is a Postgres language extension.
|
||||
|
||||
Refer to the CREATE SEQUENCE statement for information on how to create a sequence. "
|
17
src/bin/pgaccess/lib/help/drop_table.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP TABLE" {bold} " removes tables and views from the database. Only its owner may destroy a table or view. A table may be emptied of rows, but not destroyed, by using DELETE.
|
||||
|
||||
If a table being destroyed has secondary indexes on it, they will be removed first. The removal of just a secondary index will not affect the contents of the underlying table.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
DROP TABLE table \[, ...\]
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
To destroy the films and distributors tables:
|
||||
|
||||
DROP TABLE films, distributors
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
Refer to CREATE TABLE and ALTER TABLE for information on how to create or modify tables. "
|
17
src/bin/pgaccess/lib/help/drop_trigger.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP TRIGGER" {bold} " will remove all references to an existing trigger definition. To execute this command the current user must be the owner of the trigger.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP TRIGGER name ON table
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
Destroy the if_dist_exists trigger on table films:
|
||||
|
||||
DROP TRIGGER if_dist_exists ON films;
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
DROP TRIGGER is a Postgres language extension.
|
||||
|
||||
Refer to CREATE TRIGGER for information on how to create triggers. "
|
20
src/bin/pgaccess/lib/help/drop_type.hlp
Normal file
@@ -0,0 +1,20 @@
|
||||
.pgaw:Help.f.t insert end "DROP TYPE" {bold} " will remove a user type from the system catalogs.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP TYPE typename
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
To remove the box type:
|
||||
|
||||
DROP TYPE box
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
DROP TYPE statement is a Postgres language extension.
|
||||
|
||||
Refer to CREATE TYPE for inforamation on how to create types.
|
||||
|
||||
It is the user's responsibility to remove any operators, functions, aggregates, access methods, subtypes, and classes that use a deleted type.
|
||||
"
|
19
src/bin/pgaccess/lib/help/drop_user.hlp
Normal file
@@ -0,0 +1,19 @@
|
||||
.pgaw:Help.f.t insert end "DROP USER" {bold} " removes the specified user from the database, along with any databases owned by the user. It does not remove tables, views, or triggers owned by the named user in databases \
|
||||
not owned by the user. This statement can be used in place of the destroyuser script, regardless of how the user was created.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP USER username
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
To drop a user account:
|
||||
|
||||
DROP USER Jonathan;
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
DROP USER is a Postgres language extension.
|
||||
|
||||
Refer to CREATE USER and ALTER USER for information on how to create or modify user accounts.
|
||||
"
|
17
src/bin/pgaccess/lib/help/drop_view.hlp
Normal file
@@ -0,0 +1,17 @@
|
||||
.pgaw:Help.f.t insert end "DROP VIEW" {bold} " drops an existing view from the database. To execute this command you must be the owner of the view.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
DROP VIEW view
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
This command will remove the view called kinds:
|
||||
|
||||
DROP VIEW kinds;
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
The Postgres DROP TABLE statement also drops views.
|
||||
|
||||
Refer to CREATE VIEW for information on how to create views. "
|
23
src/bin/pgaccess/lib/help/explain.hlp
Normal file
@@ -0,0 +1,23 @@
|
||||
.pgaw:Help.f.t insert end "EXPLAIN" {bold} " This command outputs details about the supplied query. The default output is the computed query cost. The cost value is only meaningful to the optimizer in comparing various query plans. \
|
||||
VERBOSE displays the full query plan and cost to your screen, and pretty-prints the plan to the postmaster log file.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
EXPLAIN \[ VERBOSE \] query
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
To show a query plan for a simple query:
|
||||
" {} "
|
||||
postgres=> explain select * from foo;
|
||||
NOTICE: QUERY PLAN:
|
||||
|
||||
Seq Scan on foo (cost=0.00 rows=0 width=4)
|
||||
|
||||
EXPLAIN
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
There is only sparse documentation on the optimizer's use of cost information in Postgres. General information on cost estimation for query optimization can be found in database textbooks.
|
||||
Refer to the Programmer's Guide in the chapters on indexes and the genetic query optimizer for more \
|
||||
information."
|
62
src/bin/pgaccess/lib/help/fetch.hlp
Normal file
@@ -0,0 +1,62 @@
|
||||
.pgaw:Help.f.t insert end "FETCH" {bold} " FETCH allows a user to retrieve rows using a cursor. The number of rows retrieved is specified by #. If the number of rows remaining in the cursor is less than #, then only those available are \
|
||||
fetched. Substituting the keyword ALL in place of a number will cause all remaining rows in the cursor to be retrieved. Instances may be fetched in both FORWARD and BACKWARD \
|
||||
directions. The default direction is FORWARD.
|
||||
|
||||
Tip: Negative numbers are now allowed to be specified for the row count. A negative number is equivalent to reversing the sense of the FORWARD and BACKWARD \
|
||||
keywords. For example, FORWARD -1 is the same as BACKWARD 1.
|
||||
|
||||
Note that the FORWARD and BACKWARD keywords are Postgres extensions. The SQL92 syntax is also supported, specified in the second form of the command. See below for details on \
|
||||
compatibility issues.
|
||||
|
||||
Once all rows are fetched, every other fetch access returns no rows.
|
||||
|
||||
Updating data in a cursor is not supported by Postgres, because mapping cursor updates back to base tables is not generally possible, as is also the case with VIEW updates. Consequently, \
|
||||
users must issue explicit UPDATE commands to replace data.
|
||||
|
||||
Cursors may only be used inside of transactions because the data that they store spans multiple user queries.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
FETCH \[ selector \] \[ count \]
|
||||
\{ IN | FROM \} cursor
|
||||
FETCH \[ RELATIVE \] \[ \{ \[ # | ALL | NEXT | PRIOR \] \} \]
|
||||
FROM \] cursor
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
" {} "
|
||||
--set up and use a cursor:
|
||||
--
|
||||
BEGIN WORK;
|
||||
DECLARE liahona CURSOR
|
||||
FOR SELECT * FROM films;
|
||||
|
||||
--Fetch first 5 rows in the cursor liahona:
|
||||
--
|
||||
FETCH FORWARD 5 IN liahona;
|
||||
|
||||
code |title |did| date_prod|kind |len
|
||||
-----+-----------------------+---+----------+----------+------
|
||||
BL101|The Third Man |101|1949-12-23|Drama | 01:44
|
||||
BL102|The African Queen |101|1951-08-11|Romantic | 01:43
|
||||
JL201|Une Femme est une Femme|102|1961-03-12|Romantic | 01:25
|
||||
P_301|Vertigo |103|1958-11-14|Action | 02:08
|
||||
P_302|Becket |103|1964-02-03|Drama | 02:28
|
||||
|
||||
|
||||
--Fetch previous row:
|
||||
--
|
||||
FETCH BACKWARD 1 IN liahona;
|
||||
|
||||
code |title |did| date_prod|kind |len
|
||||
-----+-----------------------+---+----------+----------+------
|
||||
P_301|Vertigo |103|1958-11-14|Action | 02:08
|
||||
|
||||
-- close the cursor and commit work:
|
||||
--
|
||||
CLOSE liahona;
|
||||
COMMIT WORK;
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Refer to MOVE statements to change cursor position. Refer to DECLARE statements to declare a cursor. Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements for \
|
||||
further information about transactions."
|
27
src/bin/pgaccess/lib/help/form_design.hlp
Normal file
@@ -0,0 +1,27 @@
|
||||
.pgaw:Help.f.t insert end "Form designing" {title} "
|
||||
|
||||
For the moment, it has only some basic widgets : labels, entries, buttons , listboxes\
|
||||
, checkboxes and radiobuttons. Also there is a pseudo query widget that allows you\
|
||||
to have access to a query results.
|
||||
|
||||
How do you generate widgets :
|
||||
-select a widget from the toolbox by clicking the appropriate icon
|
||||
-move to the canvas , point with the mouse at the desired location and click the mouse button to begin
|
||||
-keeping the mouse-button pressed move the mouse in order to draw a rectangle that will hold the widget
|
||||
-release the mouse-button
|
||||
|
||||
In the rectangle that you have designed it will appear the selected object. Move now to the attribute window to change some of its properties.
|
||||
|
||||
Renaming, resizing items are possible (for the moment) only by modifying appropriate parameters in attribute window. You must press Enter in the edit field after changing a dimension in order to be accepted. You can also move items by dragging them or delete them by pressing Del key after selecting them.
|
||||
|
||||
In attribute window, there are some fields named Command and Variable. The field Command have meaning only for Button or checkboxes widgets and holds the command that will be invoked when the button is pressed. Also, there is a \"autoload\" style script for the form that will be executed when form will bne opened.
|
||||
|
||||
The field Variable have meaning only for Buttons, EditField , Label widgets , checkboxes and radiobuttons and it is the name of the global variable that will hold the value for that widget. For checkboxes the values are t and f (from true and false) in order to simplify binding to logical data fields.
|
||||
|
||||
For radiobuttons, it is usual to assign the same variable to the same radiobuttons within the same group. That variable will contain the value field from the radiobutton that has been pressed. Let's presume that you have entered 3 radiobuttons with values red, green and blue, all of them having the same variable named color. If you will press them, they will assign their names to global variable.
|
||||
|
||||
In order to make a simple test, put an entry field and set it's variable to v1 and a button who's command is \"set v1 whisky\". Press the button \"Test form\" and click on the button. In that entry should appear whisky.
|
||||
|
||||
Another test is defining in Script module a script called \"My first script\" having the following commands:
|
||||
" {} "tk_messageBox -title Warning -message \"This is my first message!\" " {code} "
|
||||
and then define a button with the command is Scripts::execute \"My first script\". "
|
19
src/bin/pgaccess/lib/help/forms.hlp
Normal file
@@ -0,0 +1,19 @@
|
||||
.pgaw:Help.f.t insert end "Forms" {title} "
|
||||
|
||||
Forms" {bold} " tab is used to inspect, create and design\
|
||||
database stored forms that can be later executed.
|
||||
|
||||
Forms are actually Tcl/Tk code stored in the opened database in a special table called \"pga_forms\" \
|
||||
and they can be executed by selecting it and pressing the \"Open\" button.
|
||||
|
||||
The design module will allow you do define the graphical layout of the form and\
|
||||
to bind Tcl/Tk code to different widgets. You will really need to know Tcl/Tk in\
|
||||
order to be able to write PgAccess forms.
|
||||
|
||||
Due to internal limits of PostgreSQL that cannot store more than 8Kb per record\
|
||||
and taking into account that pga_forms store one form per record it's possible that\
|
||||
too complicated forms cannot be stored into the table. Too complicated code in\
|
||||
forms could be stored in scripts instead thought scripts also are limited to the\
|
||||
8 Kb size.
|
||||
|
||||
See also " {} "form designing" {link form_design}
|
32
src/bin/pgaccess/lib/help/functions.hlp
Normal file
@@ -0,0 +1,32 @@
|
||||
.pgaw:Help.f.t insert end "Functions" {title} "
|
||||
|
||||
The Functions tab is used to inspect the user defined functions in the\
|
||||
database, to define new functions and to alter the existing ones.
|
||||
|
||||
Press the \"New\" button to define a new function. You should enter the\
|
||||
function name, the function parameters (if any) separated by comma. \
|
||||
If function returns a value, you should specify the " {} \
|
||||
"PostgreSQL data type" {link data_types} " that function will return.
|
||||
|
||||
You must also specify the language that will be used to parse the defined\
|
||||
function. You could specify SQL, plpgsql, pgtcl or C. Then you should enter the\
|
||||
function body. Press \"Save\" button in order to save it
|
||||
|
||||
" {} "Example:" {italic} "
|
||||
We have a table called \"products\" that is indexed on \"id\" (int4) field and\
|
||||
contains the float8 field \"price\". We will define a new function \"get_product_price\"\
|
||||
that will return the product price for a given id.
|
||||
|
||||
You should enter " {} "get_product_price" {code} " as the function name, " {} \
|
||||
"int4" {code} " in parameters entry, " {} "float8" {code} " for returns, " {} \
|
||||
"SQL" {code} " for the language. Then go to the function body definition and type:" {} "
|
||||
|
||||
SELECT price FROM products where id = \$1" {code} "
|
||||
|
||||
To delete a function, select it from the list box and use the menu command\
|
||||
Object/Delete.
|
||||
|
||||
For more information see SQL commands " {} "CREATE FUNCTION" {link create_function} " and " {} \
|
||||
"DROP FUNCTION" {link drop_function}
|
||||
|
||||
|
73
src/bin/pgaccess/lib/help/geomfunc.hlp
Normal file
@@ -0,0 +1,73 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Geometric functions\n\n" {title} \
|
||||
"area(box) " {bold} "
|
||||
Returns: float8
|
||||
area of box
|
||||
|
||||
" {} "area(circle) " {bold} "
|
||||
Returns: float8
|
||||
area of circle
|
||||
|
||||
" {} "box(box,box) " {bold} "
|
||||
Returns: box
|
||||
boxes to intersection box
|
||||
|
||||
" {} "center(box) " {bold} "
|
||||
Returns: point
|
||||
center of object
|
||||
|
||||
" {} "center(circle) " {bold} "
|
||||
Returns: point
|
||||
center of object
|
||||
|
||||
" {} "diameter(circle) " {bold} "
|
||||
Returns: float8
|
||||
diameter of circle
|
||||
|
||||
" {} "height(box) " {bold} "
|
||||
Returns: float8
|
||||
vertical size of box
|
||||
|
||||
" {} "isclosed(path) " {bold} "
|
||||
Returns: bool
|
||||
a closed path?
|
||||
|
||||
" {} "isopen(path) " {bold} "
|
||||
Returns: bool
|
||||
an open path?
|
||||
|
||||
" {} "length(lseg) " {bold} "
|
||||
Returns: float8
|
||||
length of line segment
|
||||
|
||||
" {} "length(path) " {bold} "
|
||||
Returns: float8
|
||||
length of path
|
||||
|
||||
" {} "pclose(path) " {bold} "
|
||||
Returns: path
|
||||
convert path to closed
|
||||
|
||||
" {} "point(lseg,lseg) " {bold} "
|
||||
Returns: point
|
||||
intersection
|
||||
|
||||
" {} "points(path) " {bold} "
|
||||
Returns: int4
|
||||
number of points
|
||||
|
||||
" {} "popen(path) " {bold} "
|
||||
Returns: path
|
||||
convert path to open
|
||||
|
||||
" {} "radius(circle) " {bold} "
|
||||
Returns: float8
|
||||
radius of circle
|
||||
|
||||
" {} "width(box) " {bold} "
|
||||
Returns: float8
|
||||
horizontal size
|
||||
|
||||
" {} \
|
||||
"PostgreSQL functions\n" {link pgfunctions} \
|
||||
"Next - IP V4 functions" {link ipv4func}
|
52
src/bin/pgaccess/lib/help/grant.hlp
Normal file
@@ -0,0 +1,52 @@
|
||||
.pgaw:Help.f.t insert end "GRANT" {bold} " GRANT allows the creator of an object to give specific permissions to all users (PUBLIC) or to a certain user or group. Users other than the creator don't have any access permission unless \
|
||||
the creator GRANTs permissions, after the object is created.
|
||||
|
||||
Once a user has a privilege on an object, he is enabled to exercise that privilege. There is no need to GRANT privileges to the creator of an object, the creator automatically holds ALL \
|
||||
privileges, and can also drop the object.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
GRANT privilege \[, ...\]
|
||||
ON object \[, ...\]
|
||||
TO \{ PUBLIC | GROUP group | username \}
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
" {} "
|
||||
-- grant insert privilege to all users on table films:
|
||||
--
|
||||
GRANT INSERT ON films TO PUBLIC;
|
||||
|
||||
|
||||
-- grant all privileges to user manuel on view kinds:
|
||||
--
|
||||
GRANT ALL ON kinds TO manuel;
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
Use the psql \\z command for further information about permissions on existing objects:
|
||||
" {} "
|
||||
Database = lusitania
|
||||
+------------------+------------------------------------------------+
|
||||
| Relation | Grant/Revoke Permissions |
|
||||
+------------------+------------------------------------------------+
|
||||
| mytable | \{\"=rw\",\"miriam=arwR\",\"group todos=rw\"\} |
|
||||
+------------------+------------------------------------------------+
|
||||
Legend:
|
||||
uname=arwR -- privileges granted to a user
|
||||
group gname=arwR -- privileges granted to a GROUP
|
||||
=arwR -- privileges granted to PUBLIC
|
||||
|
||||
r -- SELECT
|
||||
w -- UPDATE/DELETE
|
||||
a -- INSERT
|
||||
R -- RULE
|
||||
arwR -- ALL
|
||||
" {code} "Tip" {bold} "
|
||||
|
||||
Tip: Currently, to create a GROUP you have to insert data manually into table pg_group as:
|
||||
|
||||
INSERT INTO pg_group VALUES ('todos');
|
||||
CREATE USER miriam IN GROUP todos;
|
||||
|
||||
|
||||
Refer to REVOKE statements to revoke access privileges. "
|
43
src/bin/pgaccess/lib/help/history.hlp
Normal file
@@ -0,0 +1,43 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"PostgreSQL history\n\n" {title} \
|
||||
"The Berkeley Postgres project\n" {bold} \
|
||||
"Implementation of the Postgres DBMS began in 1986. The initial concepts for the system were presented in The Design of Postgres and the definition of the initial data model appeared in The Postgres Data Model. The design of the rule system at that time was described in The Design of the Postgres Rules System. The rationale and architecture of the storage manager were detailed in The Postgres Storage System.
|
||||
|
||||
Postgres has undergone several major releases since then. The first 'demoware' system became operational in 1987 and was shown at the 1988 ACM-SIGMOD Conference. We released Version 1, described in The Implementation of Postgres, to a few external users in June 1989. In response to a critique of the first rule system (A Commentary on the Postgres Rules System), the rule system was redesigned (On Rules, Procedures, Caching and Views in Database Systems) and Version 2 was released in June 1990 with the new rule system. Version 3 appeared in 1991 and added support for multiple storage managers, an improved query executor, and a rewritten rewrite rule system. For the most part, releases since then have focused on portability and reliability.
|
||||
|
||||
Postgres has been used to implement many different research and production applications. These include: a financial data analysis system, a jet engine performance monitoring package, an asteroid tracking database, a medical information database, and several geographic information systems. Postgres has also been used as an educational tool at several universities. Finally, Illustra Information Technologies (since merged into Informix) picked up the code and commercialized it. Postgres became the primary data manager for the Sequoia 2000 scientific computing project in late 1992. Furthermore, the size of the external user community nearly doubled during 1993. It became increasingly obvious that maintenance of the prototype code and support was taking up large amounts of time that should have been devoted to database research. In an effort to reduce this support burden, the project officially ended with Version 4.2.
|
||||
|
||||
" {} \
|
||||
"Postgres95\n" {bold} \
|
||||
"In 1994, Andrew Yu and Jolly Chen added a SQL language interpreter to Postgres, and the code was subsequently released to the Web to find its own way in the world. Postgres95 was a public-domain, open source descendant of this original Berkeley code.
|
||||
|
||||
Postgres95 is a derivative of the last official release of Postgres (version 4.2). The code is now completely ANSI C and the code size has been trimmed by 25%. There are a lot of internal changes that improve performance and code maintainability. Postgres95 v1.0.x runs about 30-50% faster on the Wisconsin Benchmark compared to v4.2. Apart from bug fixes, these are the major enhancements:
|
||||
|
||||
The query language Postquel has been replaced with SQL (implemented in the server). We do not yet support subqueries (which can be imitated with user defined SQL functions). Aggregates have been re-implemented. We also added support for ``GROUP BY''. The libpq interface is still available for C programs.
|
||||
|
||||
In addition to the monitor program, we provide a new program (psql) which supports GNU readline.
|
||||
|
||||
We added a new front-end library, libpgtcl, that supports Tcl-based clients. A sample shell, pgtclsh, provides new Tcl commands to interface tcl programs with the Postgres95 backend.
|
||||
|
||||
The large object interface has been overhauled. We kept Inversion large objects as the only mechanism for storing large objects. (This is not to be confused with the Inversion file system which has been removed.)
|
||||
|
||||
The instance-level rule system has been removed. Rules are still available as rewrite rules.
|
||||
|
||||
A short tutorial introducing regular SQL features as well as those of ours is distributed with the source code.
|
||||
|
||||
GNU make (instead of BSD make) is used for the build. Also, Postgres95 can be compiled with an unpatched gcc (data alignment of doubles has been fixed).
|
||||
|
||||
|
||||
" {} \
|
||||
"PostgreSQL\n" {bold} \
|
||||
"By 1996, it became clear that the name \"Postgres95\" would not stand the test of time. A new name, PostgreSQL, was chosen to reflect the relationship between original Postgres and the more recent versions with SQL capability. At the same time, the version numbering was reset to start at 6.0, putting the numbers back into the sequence originally begun by the Postgres Project.
|
||||
|
||||
The emphasis on development for the v1.0.x releases of Postgres95 was on stabilizing the backend code. With the v6.x series of PostgreSQL, the emphasis has shifted from identifying and understanding existing problems in the backend to augmenting features and capabilities, although work continues in all areas.
|
||||
|
||||
Major enhancements include:
|
||||
|
||||
- Important backend features, including subselects, defaults, constraints, and triggers, have been implemented.
|
||||
- Additional SQL92-compliant language features have been added, including primary keys, quoted identifiers, literal string type coersion, type casting, and binary and hexadecimal integer input.
|
||||
- Built-in types have been improved, including new wide-range date/time types and additional geometric type support.
|
||||
- Overall backend code speed has been increased by approximately 20-40%, and backend startup time has decreased 80% since v6.0 was released."
|
||||
|
19
src/bin/pgaccess/lib/help/index.hlp
Normal file
@@ -0,0 +1,19 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"PgAccess help index" {title} \
|
||||
"
|
||||
|
||||
Topics available:
|
||||
" {} \
|
||||
" Tables\n" {link tables} \
|
||||
" Queries\n" {link queries} \
|
||||
" Views\n" {link views} \
|
||||
" Sequences\n" {link sequences} \
|
||||
" Functions\n" {link functions} \
|
||||
" Reports\n" {link reports} \
|
||||
" Forms\n" {link forms} \
|
||||
" Scripts\n" {link scripts} \
|
||||
" Users\n" {link users} \
|
||||
" Schema\n\n" {link schema} \
|
||||
" PostgreSQL\n" {link postgresql} \
|
||||
" The author of PgAccess\n" {link author}
|
||||
|
49
src/bin/pgaccess/lib/help/inheritance.hlp
Normal file
@@ -0,0 +1,49 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Inheritance" {title} "
|
||||
|
||||
Let's create two classes. The capitals class contains state capitals which are also cities. Naturally, the capitals class should inherit from cities.
|
||||
|
||||
" {} "CREATE TABLE cities (
|
||||
name text,
|
||||
population float,
|
||||
altitude int -- (in ft)
|
||||
);
|
||||
|
||||
CREATE TABLE capitals (
|
||||
state char2
|
||||
) INHERITS (cities);
|
||||
" {code} "
|
||||
In this case, an instance of capitals inherits all attributes (name, population, and altitude) from its parent, cities. The type of the attribute name is text, a native Postgres type for variable length ASCII strings. The type of the attribute population is float, a native Postgres type for double precision floating point numbers. State capitals have an extra attribute, state, that shows their state. In Postgres, a class can inherit from zero or more other classes, and a query can reference either all instances of a class or all instances of a class plus all of its descendants.
|
||||
|
||||
" {} "Note" {italic} ": The inheritance hierarchy is a actually a directed acyclic graph.
|
||||
|
||||
For example, the following query finds all the cities that are situated at an attitude of 500ft or higher:
|
||||
|
||||
" {} "SELECT name, altitude FROM cities WHERE altitude > 500;
|
||||
|
||||
+----------+----------+
|
||||
|name | altitude |
|
||||
+----------+----------+
|
||||
|Las Vegas | 2174 |
|
||||
+----------+----------+
|
||||
|Mariposa | 1953 |
|
||||
+----------+----------+
|
||||
" {code} "
|
||||
On the other hand, to find the names of all cities, including state capitals, that are located at an altitude over 500ft, the query is:
|
||||
|
||||
" {} "SELECT c.name, c.altitude FROM cities* c WHERE c.altitude > 500;
|
||||
|
||||
" {code} "which returns:" {} "
|
||||
|
||||
+----------+----------+
|
||||
|name | altitude |
|
||||
+----------+----------+
|
||||
|Las Vegas | 2174 |
|
||||
+----------+----------+
|
||||
|Mariposa | 1953 |
|
||||
+----------+----------+
|
||||
|Madison | 845 |
|
||||
+----------+----------+
|
||||
" {code} "
|
||||
Here the \"*\" after cities indicates that the query should be run over cities and all classes below cities in the inheritance hierarchy. Many of the commands that we have already discussed -- select, update and delete -- support this \"*\" notation, as do others, like alter.
|
||||
" {}
|
54
src/bin/pgaccess/lib/help/insert.hlp
Normal file
@@ -0,0 +1,54 @@
|
||||
.pgaw:Help.f.t insert end "INSERT" {bold} " allows one to insert new rows into a table. One can insert a single row at time or several rows as a result of a query. The columns in the target list may be listed in any order. In every \
|
||||
column not present in the target list will be inserted the default value, if column has not a declared default value it will be assumed as NULL. If the expression for each column is not of the \
|
||||
correct data type, automatic type coercion will be attempted.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
INSERT INTO table \[ ( column \[, ...\] ) \]
|
||||
\{ VALUES ( expression \[, ...\] ) | SELECT query \}
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
" {} "
|
||||
--Insert a single row into table films;
|
||||
--(in the second example the column date_prod is omitted
|
||||
--therefore will be stored in it a default value of NULL):
|
||||
--
|
||||
INSERT INTO films VALUES
|
||||
('UA502','Bananas',105,'1971-07-13','Comedy',INTERVAL '82 minute');
|
||||
|
||||
INSERT INTO films (code, title, did, date_prod, kind)
|
||||
VALUES ('T_601', 'Yojimbo', 106, DATE '1961-06-16', 'Drama');
|
||||
|
||||
|
||||
--Insert a single row into table distributors, note that
|
||||
--only column \"name\" is specified, to the non specified
|
||||
--column \"did\" will be assigned its default value:
|
||||
--
|
||||
INSERT INTO distributors (name) VALUES ('British Lion');
|
||||
|
||||
|
||||
--Insert several rows into table films from table tmp:
|
||||
--
|
||||
INSERT INTO films
|
||||
SELECT * FROM tmp;
|
||||
|
||||
|
||||
--Insert into arrays:
|
||||
--Create an empty 3x3 gameboard for noughts-and-crosses
|
||||
--(all of these queries create the same board attribute)
|
||||
--(Refer to the PostgreSQL User's Guide for further
|
||||
--information about arrays).
|
||||
|
||||
INSERT INTO tictactoe (game, board\[1:3\]\[1:3\])
|
||||
VALUES (1,'\{\{\"\",\"\",\"\"\},\{\},\{\"\",\"\"\}\}');
|
||||
INSERT INTO tictactoe (game, board\[3\]\[3\])
|
||||
VALUES (2,'\{\}');
|
||||
INSERT INTO tictactoe (game, board)
|
||||
VALUES (3,'\{\{,,\},\{,,\},\{,,\}\}');
|
||||
|
||||
" {code} "Compatibility" {bold} "
|
||||
|
||||
SQL92
|
||||
|
||||
The INSERT statement is fully compatible with SQL92. Possible limitations in features of the query clause are documented for the SELECT statement.
|
||||
"
|
28
src/bin/pgaccess/lib/help/ipv4func.hlp
Normal file
@@ -0,0 +1,28 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"IP V4 functions\n\n" {title} \
|
||||
"broadcast(cidr)" {bold} "
|
||||
Returns: text
|
||||
construct broadcast address as text
|
||||
|
||||
" {} "broadcast(inet) " {bold} "
|
||||
Returns: text
|
||||
construct broadcast address as text
|
||||
|
||||
" {} "host(inet) " {bold} "
|
||||
Returns: text
|
||||
extract host address as text
|
||||
|
||||
" {} "masklen(cidr) " {bold} "
|
||||
Returns: int4
|
||||
calculate netmask length
|
||||
|
||||
" {} "masklen(inet) " {bold} "
|
||||
Returns: int4
|
||||
calculate netmask length
|
||||
|
||||
" {} "netmask(inet) " {bold} "
|
||||
Returns: text
|
||||
construct netmask as text
|
||||
|
||||
" {} \
|
||||
"PostgreSQL functions\n" {link pgfunctions}
|
24
src/bin/pgaccess/lib/help/isolation.hlp
Normal file
@@ -0,0 +1,24 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Isolation levels" {title} "
|
||||
|
||||
" {} "Read Committed Isolation Level" {bold} "
|
||||
|
||||
Read Committed is the default isolation level in Postgres. When a transaction runs on this isolation level, a query sees only data committed before the query began and never sees either dirty data or concurrent transaction changes committed during query execution.
|
||||
|
||||
If a row returned by a query while executing an UPDATE statement (or DELETE or SELECT FOR UPDATE) is being updated by a concurrent uncommitted transaction then the second transaction that tries to update this row will wait for the other transaction to commit or rollback. In the case of rollback, the waiting transaction can proceed to change the row. In the case of commit (and if the row still exists; i.e. was not deleted by the other transaction), the query will be re-executed for this row to check that new row version satisfies query search condition. If the new row version satisfies the query search condition then row will be updated (or deleted or marked for update).
|
||||
|
||||
Note that the results of execution of SELECT or INSERT (with a query) statements will not be affected by concurrent transactions.
|
||||
|
||||
|
||||
" {} "Serializable Isolation Level" {bold} "
|
||||
|
||||
Serializable provides the highest transaction isolation. When a transaction is on the serializable level, a query sees only data committed before the transaction began and never see either dirty data or concurrent transaction changes committed during transaction execution. So, this level emulates serial transaction execution, as if transactions would be executed one after another, serially, rather than concurrently.
|
||||
|
||||
If a row returned by query while executing a UPDATE (or DELETE or SELECT FOR UPDATE) statement is being updated by a concurrent uncommitted transaction then the second transaction that tries to update this row will wait for the other transaction to commit or rollback. In the case of rollback, the waiting transaction can proceed to change the row. In the case of a concurrent transaction commit, a serializable transaction will be rolled back with the message
|
||||
|
||||
" {} "ERROR: Can't serialize access due to concurrent update" {code} "
|
||||
|
||||
because a serializable transaction cannot modify rows changed by other transactions after the serializable transaction began.
|
||||
|
||||
" {} "Note" {italic} ": Note that results of execution of SELECT or INSERT (with a query) will not be affected by concurrent transactions.
|
||||
"
|
85
src/bin/pgaccess/lib/help/keywords.hlp
Normal file
@@ -0,0 +1,85 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"PostgreSQL reserved key words\n\n" {title} \
|
||||
"The following are Postgres reserved words which are also SQL92 or SQL3 reserved words: " {} \
|
||||
"
|
||||
ADD ALL ALTER AND ANY AS ASC
|
||||
BEGIN BETWEEN BOTH BY
|
||||
CASCADE CAST CHAR CHARACTER CHECK CLOSE
|
||||
COLLATE COLUMN COMMIT CONSTRAINT
|
||||
CREATE CURRENT_DATE CURRENT_TIME
|
||||
CURRENT_TIMESTAMP CURRENT_USER CURSOR
|
||||
DECIMAL DECLARE DEFAULT DELETE DESC DISTINCT DROP
|
||||
EXECUTE EXISTS EXTRACT
|
||||
FETCH FLOAT FOR FROM FULL
|
||||
GRANT
|
||||
HAVING
|
||||
IN INNER INSERT INTERVAL INTO IS
|
||||
JOIN
|
||||
LEADING LEFT LIKE LOCAL
|
||||
NAMES NATIONAL NATURAL NCHAR NO NOT NULL NUMERIC
|
||||
ON OR OUTER
|
||||
PARTIAL PRIMARY PRIVILEGES PROCEDURE PUBLIC
|
||||
REFERENCES REVOKE RIGHT ROLLBACK
|
||||
SELECT SET SUBSTRING
|
||||
TO TRAILING TRIM
|
||||
UNION UNIQUE UPDATE USER USING
|
||||
VALUES VARCHAR VARYING VIEW
|
||||
WHERE WITH WORK
|
||||
|
||||
" {code} \
|
||||
"The following are Postgres reserved words which are neither SQL92 nor SQL3 reserved words. These are allowed to be present as column labels, but not as identifiers: " {} \
|
||||
"
|
||||
ABORT ANALYZE
|
||||
BINARY
|
||||
CLUSTER CONSTRAINT COPY
|
||||
DO
|
||||
EXPLAIN EXTEND
|
||||
LISTEN LOAD LOCK
|
||||
MOVE
|
||||
NEW NONE NOTIFY
|
||||
RESET
|
||||
SETOF SHOW
|
||||
UNLISTEN UNTIL
|
||||
VACUUM VERBOSE
|
||||
|
||||
" {code} \
|
||||
"The following are Postgres reserved words which are also SQL92 or SQL3 reserved words, and which are allowed to be present as column labels, but not as identifiers: " {} \
|
||||
"
|
||||
CASE COALESCE CROSS CURRENT
|
||||
ELSE END
|
||||
FALSE FOREIGN
|
||||
GLOBAL GROUP
|
||||
LOCAL
|
||||
NULLIF
|
||||
ORDER
|
||||
POSITION PRECISION
|
||||
TABLE THEN TRANSACTION TRUE
|
||||
WHEN
|
||||
|
||||
" {code} \
|
||||
"The following are either SQL92 or SQL3 reserved key words which are not key words in Postgres. These have no proscribed usage in Postgres at the time of writing (v6.5) but may become reserved key words in the future: " {} \
|
||||
"
|
||||
|
||||
Note: Some of these key words represent functions in SQL92. These functions are defined in Postgres, but the parser does not consider the names to be key words and they are allowed in other contexts.
|
||||
|
||||
ALLOCATE ARE ASSERTION AT AUTHORIZATION AVG
|
||||
BIT BIT_LENGTH
|
||||
CASCADED CATALOG COLLATION CONNECT CONNECTION
|
||||
CONSTRAINTS CONTINUE CONVERT CORRESPONDING COUNT
|
||||
DATE DEALLOCATE DEC DESCRIBE DESCRIPTOR DIAGNOSTICS DISCONNECT DOMAIN
|
||||
END-EXEC ESCAPE EXCEPT EXCEPTION EXEC EXTERNAL
|
||||
FIRST FOUND
|
||||
GET GO GOTO
|
||||
IDENTITY IMMEDIATE INDICATOR INITIALLY INPUT INTERSECT ISOLATION
|
||||
LAST LEVEL LOWER
|
||||
MAX MIN MODULE
|
||||
OCTET_LENGTH OPEN OUTPUT OVERLAPS
|
||||
PREPARE PRESERVE
|
||||
RESTRICT ROWS
|
||||
SCHEMA SECTION SESSION SESSION_USER SIZE SOME
|
||||
SQL SQLCODE SQLERROR SQLSTATE SUM SYSTEM_USER
|
||||
TEMPORARY TRANSLATE TRANSLATION
|
||||
UNKNOWN UPPER USAGE
|
||||
VALUE
|
||||
WHENEVER WRITE
|
||||
" {code}
|
34
src/bin/pgaccess/lib/help/listen.hlp
Normal file
@@ -0,0 +1,34 @@
|
||||
.pgaw:Help.f.t insert end "LISTEN" {bold} " registers the current Postgres backend as a listener on the notify condition notifyname. \
|
||||
|
||||
Whenever the command NOTIFY notifyname is invoked, either by this backend or another one connected to the same database, all the backends currently listening on that notify condition are \
|
||||
notified, and each will in turn notify its connected frontend application. See the discussion of NOTIFY for more information. \
|
||||
|
||||
A backend can be deregistered for a given notify condition with the UNLISTEN command. Also, a backend's listen registrations are automatically cleared when the backend process exits. \
|
||||
|
||||
The method a frontend application must use to detect notify events depends on which Postgres application programming interface it uses. With the basic libpq library, the application issues \
|
||||
LISTEN as an ordinary SQL command, and then must periodically call the routine PQnotifies to find out whether any notify events have been received. Other interfaces such as libpgtcl provide \
|
||||
higher-level methods for handling notify events; indeed, with libpgtcl the application programmer should not even issue LISTEN or UNLISTEN directly. See the documentation for the library \
|
||||
you are using for more details.
|
||||
|
||||
The reference page for NOTIFY contains a more extensive discussion of the use of LISTEN and NOTIFY.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
LISTEN notifyname
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
" {} "
|
||||
-- Configure and execute a listen/notify sequence from psql
|
||||
postgres=> listen virtual;
|
||||
LISTEN
|
||||
postgres=> notify virtual;
|
||||
NOTIFY
|
||||
ASYNC NOTIFY of 'virtual' from backend pid '11239' received
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
notifyname can be any string valid as a name; it need not correspond to the name of any actual table. If notifyname is enclosed in double-quotes, it need not even be a syntactically valid name, \
|
||||
but can be any string up to 31 characters long.
|
||||
|
||||
In some previous releases of Postgres, notifyname had to be enclosed in double-quotes when it did not correspond to any existing table name, even if syntactically valid as a name. That is no \
|
||||
longer required. "
|
27
src/bin/pgaccess/lib/help/load.hlp
Normal file
@@ -0,0 +1,27 @@
|
||||
.pgaw:Help.f.t insert end "LOAD" {bold} " Loads an object (or \".o\") file into the Postgres backend address space. Once a file is loaded, all functions in that file can be accessed. This function is used in support of user-defined types and \
|
||||
functions.
|
||||
|
||||
If a file is not loaded using LOAD, the file will be loaded automatically the first time the function is called by Postgres. LOAD can also be used to reload an object file if it has been edited and \
|
||||
recompiled. Only objects created from C language files are supported at this time.
|
||||
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
|
||||
LOAD 'filename'
|
||||
|
||||
" {} "Usage" {bold} "
|
||||
|
||||
--Load the file /usr/postgres/demo/circle.o
|
||||
--
|
||||
LOAD '/usr/postgres/demo/circle.o'
|
||||
|
||||
" {} "Notes" {bold} "
|
||||
|
||||
Functions in loaded object files should not call functions in other object files loaded through the LOAD command. For example, all functions in file A should call each other, functions in the \
|
||||
standard or math libraries, or in Postgres itself. They should not call functions defined in a different loaded file B. This is because if B is reloaded, the Postgres loader is not able to relocate the \
|
||||
calls from the functions in A into the new address space of B. If B is not reloaded, however, there will not be a problem.
|
||||
|
||||
Object files must be compiled to contain position independent code. For example, on DECstations you must use /bin/cc with the -G 0 option when compiling object files to be loaded. \
|
||||
|
||||
Note that if you are porting Postgres to a new platform, LOAD will have to work in order to support ADTs.
|
||||
"
|
49
src/bin/pgaccess/lib/help/lock.hlp
Normal file
@@ -0,0 +1,49 @@
|
||||
.pgaw:Help.f.t insert end "LOCK" {bold} " Postgres always uses the least restrictive lock mode whenever possible. LOCK TABLE provided for cases when you might need more restrictive locking.
|
||||
|
||||
For example, an application runs a transaction at READ COMMITTED isolation level and needs to ensure the existance of data in a table for the duration of the transaction. To achieve this you \
|
||||
could use SHARE lock mode over the table before querying. This will protect data from concurrent changes and provide any further read operations over the table with data in their actual current \
|
||||
state, because SHARE lock mode conflicts with any ROW EXCLUSIVE one acquired by writers, and your LOCK TABLE table IN SHARE MODE statement will wait until any concurrent \
|
||||
write operations commit or rollback.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
LOCK \[ TABLE \] table
|
||||
LOCK \[ TABLE \] table IN \[ ROW | ACCESS \] \{ SHARE | EXCLUSIVE \} MODE
|
||||
LOCK \[ TABLE \] table IN SHARE ROW EXCLUSIVE MODE
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
--
|
||||
-- SHARE lock primary key table when going to perform
|
||||
-- insert into foreign key table.
|
||||
--
|
||||
" {} " BEGIN WORK;
|
||||
LOCK TABLE films IN SHARE MODE;
|
||||
SELECT id FROM films
|
||||
WHERE name = 'Star Wars: Episode I - The Phantom Menace';
|
||||
--
|
||||
-- Do ROLLBACK if record was not returned
|
||||
--
|
||||
INSERT INTO films_user_comments VALUES
|
||||
(_id_, 'GREAT! I was waiting for it for so long!');
|
||||
COMMIT WORK;
|
||||
|
||||
|
||||
--
|
||||
-- SHARE ROW EXCLUSIVE lock primary key table when going to perform
|
||||
-- delete operation.
|
||||
--
|
||||
BEGIN WORK;
|
||||
LOCK TABLE films IN SHARE ROW EXCLUSIVE MODE;
|
||||
DELETE FROM films_user_comments WHERE id IN
|
||||
(SELECT id FROM films WHERE rating < 5);
|
||||
DELETE FROM films WHERE rating < 5;
|
||||
COMMIT WORK;
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
LOCK is a Postgres language extension.
|
||||
|
||||
Except for ACCESS SHARE/EXCLUSIVE lock modes, all other Postgres lock modes and the LOCK TABLE syntax are compatible with those present in Oracle.
|
||||
|
||||
LOCK works only inside transactions. "
|
34
src/bin/pgaccess/lib/help/mathfunc.hlp
Normal file
@@ -0,0 +1,34 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Mathematical functions\n\n" {title} \
|
||||
"dexp(float8)" {bold} \
|
||||
"
|
||||
Returns: float8
|
||||
raise e to the specified exponent
|
||||
|
||||
" {} \
|
||||
"dpow(float8,float8)" {bold} \
|
||||
"
|
||||
Returns: float8
|
||||
raise a number to the specified exponent
|
||||
|
||||
" {} \
|
||||
"float(int)" {bold} \
|
||||
"
|
||||
Returns: float8
|
||||
convert integer to floating point
|
||||
|
||||
" {} \
|
||||
"float4(int)" {bold} \
|
||||
"
|
||||
Returns: float4
|
||||
convert integer to floating point
|
||||
|
||||
" {} \
|
||||
"integer(float)" {bold} \
|
||||
"
|
||||
Returns: int
|
||||
convert floating point to integer
|
||||
|
||||
" {} \
|
||||
"PostgreSQL functions\n" {link pgfunctions} \
|
||||
"Next - string functions" {link stringfunc}
|
43
src/bin/pgaccess/lib/help/move.hlp
Normal file
@@ -0,0 +1,43 @@
|
||||
.pgaw:Help.f.t insert end "MOVE" {bold} "allows a user to move cursor position a specified number of rows. MOVE works like the FETCH command, but only positions the cursor and does not return rows.
|
||||
|
||||
Refer to the FETCH command for details on syntax and usage.
|
||||
|
||||
" {} "Synopsis" {bold} "
|
||||
" {} "
|
||||
MOVE \[ selector \] \[ count \]
|
||||
\{ IN | FROM \} cursor
|
||||
FETCH \[ RELATIVE \] \[ \{ \[ # | ALL | NEXT | PRIOR \] \} \] FROM \] cursor
|
||||
|
||||
|
||||
" {code} "Usage" {bold} "
|
||||
|
||||
--set up and use a cursor:
|
||||
--
|
||||
" {} " BEGIN WORK;
|
||||
DECLARE liahona CURSOR FOR SELECT * FROM films;
|
||||
|
||||
--Skip first 5 rows:
|
||||
--
|
||||
MOVE FORWARD 5 IN liahona;
|
||||
MOVE
|
||||
|
||||
--Fetch 6th row in the cursor liahona:
|
||||
--
|
||||
FETCH 1 IN liahona;
|
||||
FETCH
|
||||
code |title |did| date_prod|kind |len
|
||||
-----+------+---+----------+----------+------
|
||||
P_303|48 Hrs|103|1982-10-22|Action | 01:37
|
||||
(1 row)
|
||||
|
||||
-- close the cursor liahona and commit work:
|
||||
--
|
||||
CLOSE liahona;
|
||||
COMMIT WORK;
|
||||
|
||||
" {code} "Notes" {bold} "
|
||||
|
||||
MOVE is a Postgres language extension.
|
||||
|
||||
Refer to FETCH for a description of valid arguments. Refer to DECLARE to declare a cursor. Refer to BEGIN WORK, COMMIT WORK, ROLLBACK WORK statements for further \
|
||||
information about transactions. "
|
13
src/bin/pgaccess/lib/help/mvcc.hlp
Normal file
@@ -0,0 +1,13 @@
|
||||
.pgaw:Help.f.t insert end \
|
||||
"Multi-Version Concurrency Control" {title} "
|
||||
|
||||
Multi-Version Concurrency Control (MVCC) is an advanced technique for\
|
||||
improving database performance in a multi-user environment. " {} "Vadim Mikheev" {bold} " provided the implementation for Postgres.
|
||||
|
||||
" {} "Introduction" {bold} "
|
||||
|
||||
Unlike most other database systems which use locks for concurrency control, Postgres maintains data consistency by using a multiversion model. This means that while querying a database each transaction sees a snapshot of data (a database version) as it was some time ago, regardless of the current state of the underlying data. This protects the transaction from viewing inconsistent data that could be caused by (other) concurrent transaction updates on the same data rows, providing transaction isolation for each database session.
|
||||
|
||||
The main difference between multiversion and lock models is that in MVCC locks acquired for querying (reading) data don't conflict with locks acquired for writing data and so reading never blocks writing and writing never blocks reading.
|
||||
|
||||
" {} "Isolation levels" {link isolation}
|