mirror of https://github.com/postgres/postgres
ecpg reference page still needs formatting.REL7_0_PATCHES
parent
2aa64f79f5
commit
a27512e634
@ -0,0 +1,367 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/ecpg-ref.sgml,v 1.1 1999/07/22 15:09:11 thomas Exp $ |
||||
Postgres documentation |
||||
--> |
||||
|
||||
<refentry id="APP-ECPG"> |
||||
<refmeta> |
||||
<refentrytitle id="app-ecpg-title"> |
||||
<application>ecpg</application> |
||||
</refentrytitle> |
||||
<refmiscinfo>Application</refmiscinfo> |
||||
</refmeta> |
||||
<refnamediv> |
||||
<refname> |
||||
<application>ecpg</application> |
||||
</refname> |
||||
<refpurpose> |
||||
Embedded SQL C preprocessor |
||||
</refpurpose> |
||||
</refnamediv> |
||||
<refsynopsisdiv> |
||||
<refsynopsisdivinfo> |
||||
<date>1999-07-20</date> |
||||
</refsynopsisdivinfo> |
||||
<synopsis> |
||||
ecpg [ -v ] [ -t ] [ -I include-path ] [ -o outfile ] file1 [ file2 ] [ ... ] |
||||
</synopsis> |
||||
|
||||
<refsect2 id="R2-APP-ECPG-1"> |
||||
<refsect2info> |
||||
<date>1999-07-20</date> |
||||
</refsect2info> |
||||
<title> |
||||
Inputs |
||||
</title> |
||||
<para> |
||||
<application>ecpg</application> accepts the following command |
||||
line arguments: |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><replaceable class="parameter">file</replaceable></term> |
||||
<listitem> |
||||
<para> |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</para> |
||||
</refsect2> |
||||
|
||||
<refsect2 id="R2-APP-ECPG-2"> |
||||
<refsect2info> |
||||
<date>1998-11-05</date> |
||||
</refsect2info> |
||||
<title> |
||||
Outputs |
||||
</title> |
||||
<para> |
||||
<application>ecpg</application> will create a file or |
||||
write to <filename>stdout</filename>. |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput> |
||||
</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</para> |
||||
</refsect2> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1 id="R1-APP-ECPG-1"> |
||||
<refsect1info> |
||||
<date>1998-11-05</date> |
||||
</refsect1info> |
||||
<title> |
||||
Description |
||||
</title> |
||||
<para> |
||||
<!-- |
||||
.TH ECPG UNIX 11/28/98 PostgreSQL \fIPostgreSQL\fP |
||||
.SH NAME |
||||
ecpg - embedded SQL preprocessor for C / PostgreSQL |
||||
.SH SYNOPSIS |
||||
.\" \fBecpg\fR [-v ] [-t] [-I include-path ] [-o outfile ] file1 [ file2 ] [ ... ] |
||||
\fBecpg\fR [-v ] [-t] [-I include-path ] [-o outfile ] file1 [ file2 ] [ ... ] |
||||
.SH DESCRIPTION |
||||
.B \fIecpg\fP |
||||
is an embedded SQL preprocessor for C / PostgreSQL. It |
||||
enables development of C programs with embedded SQL code. |
||||
.PP |
||||
.B \fIecpg\fP |
||||
is ultimately intended to be as compliant as possible with the |
||||
ANSI SQL-2 standard and existing commercial ESQL/C packages. |
||||
.SH OPTIONS |
||||
.B \fIecpg\fP |
||||
interprets the following flags when it is invoked |
||||
on the command line: |
||||
.PP |
||||
.PD 0 |
||||
.TP 10 |
||||
.BI \-v |
||||
Print version information. |
||||
.PD |
||||
.TP |
||||
.B \-t |
||||
Turn off auto-transactin mode. |
||||
.PD |
||||
.TP |
||||
.PD |
||||
.TP |
||||
.B \-I include-path |
||||
Specify additional include path. Defaults are \., |
||||
/usr/local/include, the PostgreSQL include path which is defined at compile |
||||
time (default: /usr/local/pgsql/lib), /usr/include |
||||
.PD |
||||
.TP |
||||
.B \-o |
||||
Specifies that ecpg should write all its output to outfile. |
||||
If no such option is given the output is written to foo.c |
||||
(if the input file was named foo.pgc.) |
||||
If the input file was named foo.bar the output file will be |
||||
named foo.bar.c. |
||||
.PD |
||||
.TP |
||||
.B file1, file2... |
||||
The files to be processed. |
||||
.\" |
||||
.SH INSTALLATION |
||||
The |
||||
.B \fIecpg\fP |
||||
preprocessor is built during the PostgreSQL installation. Binaries and |
||||
libraries are installed into the PGBASE (i.e., /usr/local/pgsql/... ) |
||||
subdirectories. |
||||
.SH PREPROCESSING FOR COMPILATION |
||||
.B \fIecpg\fP |
||||
.\" (-d ) (-o file) file.pgc ( 2> ecpf.log) |
||||
(-o file) file.pgc |
||||
.LP |
||||
.\" The optional \-d flag turns on debugging and 2> ecpg.log |
||||
.\" redirects the debug output. The .pgc extension is an |
||||
.\" arbitrary means of denoting ecpg source. |
||||
The .pgc extension is an arbitrary means of denoting ecpg source. |
||||
.SH COMPILING AND LINKING |
||||
Assuming the \fIPostgreSQL\fP binaries are in /usr/local/pgsql: |
||||
.LP |
||||
gcc -g -i /usr/local/pgsql/include (-o file) file.c |
||||
-L /usr/local/pgsql/lib -lecpg -lpq |
||||
.SH ECPG GRAMMAR |
||||
.LP |
||||
.SH LIBRARIES |
||||
.LP |
||||
The preprocessor will prepend two directives to the source: |
||||
.LP |
||||
\fI#include <ecpgtype.h>\fP and \fI#include <ecpglib.h>\fP |
||||
.SH VARIABLE DECLARATION |
||||
Variables declared within ecpg source code must be prepended with: |
||||
.LP |
||||
EXEC SQL BEGIN DECLARE SECTION; |
||||
.LP |
||||
Similarly, variable declaration sections must terminate with: |
||||
.LP |
||||
EXEC SQL END DECLARE SECTION; |
||||
.LP |
||||
NOTE: prior to version 2.1.0, each variable had to be declared |
||||
on a separate line. As of version 2.1.0 multiple variables may |
||||
be declared on a single line: |
||||
.LP |
||||
char foo(16), bar(16); |
||||
.LP |
||||
.SH ERROR HANDLING |
||||
The SQL communication area is defined with: |
||||
.LP |
||||
EXEC SQL INCLUDE sqlca; |
||||
.LP |
||||
NOTE: the lowercase `sqlca'. While SQL convention may be |
||||
followed, i.e., using uppercase to separate embedded SQL |
||||
from C statements, sqlca (which includes the sqlca.h |
||||
header file) MUST be lowercase. This is because the EXEC SQL |
||||
prefix indicates that this INCLUDE will be parsed by ecpg. |
||||
ecpg observes case sensitivity (SQLCA.h will not be found.) |
||||
EXEC SQL INCLUDE can be used to include other header files |
||||
as long as case sensitivity is observed. |
||||
.LP |
||||
The sqlprint command is used with the EXEC SQL WHENEVER |
||||
statement to turn on error handling throughout the |
||||
program: |
||||
.LP |
||||
EXEC SQL WHENEVER sqlerror sqlprint; |
||||
.LP |
||||
EXEC SQL WHENEVER not found sqlprint; |
||||
.LP |
||||
PLEASE NOTE: this is *not* an exhaustive example of usage for |
||||
the EXEC SQL WHENEVER statement. Further examples of usage may |
||||
be found in SQL manuals (e.g., `The LAN TIMES Guide to SQL' by |
||||
Groff and Weinberg.) |
||||
.LP |
||||
.SH CONNECTING TO THE DATABASE SERVER |
||||
Prior to version 2.1.0 the database name was single quoted: |
||||
.RS |
||||
EXEC SQL CONNECT 'test1'; |
||||
.RE |
||||
.LP |
||||
As of version 2.1.0, the syntax has been simplified: |
||||
.LP |
||||
.RS |
||||
EXEC SQL CONNECT test1; |
||||
.RE |
||||
(The database name is no longer quoted.) |
||||
.LP |
||||
Specifying a server and port name in the connect statement is also possible |
||||
as of version 6.4. of PostgreSQL. The syntax is: |
||||
.LP |
||||
.RS |
||||
dbname[@server][:port] |
||||
.RE |
||||
.LP |
||||
or |
||||
.LP |
||||
.RS |
||||
<tcp|unix>:postgresql://server[:port][/dbname][?options] |
||||
.RE |
||||
.SH QUERIES |
||||
.LP |
||||
.SS Create Table: |
||||
.LP |
||||
EXEC SQL CREATE TABLE foo (number int4, ascii char(16)); |
||||
.RS |
||||
EXEC SQL CREATE UNIQUE index num1 on foo(number); |
||||
.RE |
||||
EXEC SQL COMMIT; |
||||
.LP |
||||
.SS Insert: |
||||
.LP |
||||
EXEC SQL INSERT INTO foo (number, ascii) |
||||
.RS |
||||
VALUES (9999, 'doodad'); |
||||
.RE |
||||
EXEC SQL COMMIT; |
||||
.LP |
||||
.SS Delete: |
||||
.LP |
||||
EXEC SQL DELETE FROM foo |
||||
.RS |
||||
WHERE number = 9999; |
||||
.RE |
||||
EXEC SQL COMMIT; |
||||
.LP |
||||
.SS Singleton Select: |
||||
.LP |
||||
EXEC SQL SELECT foo INTO :FooBar FROM table1 |
||||
.RS |
||||
WHERE ascii = 'doodad'; |
||||
.RE |
||||
.LP |
||||
.SS Select using Cursors: |
||||
.LP |
||||
EXEC SQL DECLARE foo_bar CURSOR FOR |
||||
.RS |
||||
SELECT number, ascii FROM foo |
||||
.RS |
||||
ORDER BY ascii; |
||||
.RE |
||||
.RE |
||||
EXEC SQL FETCH foo_bar INTO :FooBar, DooDad; |
||||
.LP |
||||
... |
||||
EXEC SQL CLOSE foo_bar; |
||||
.RS |
||||
EXEC SQL COMMIT; |
||||
.RE |
||||
.LP |
||||
.SS Updates |
||||
.LP |
||||
EXEC SQL UPDATE foo |
||||
.RS |
||||
SET ascii = 'foobar' |
||||
.RE |
||||
.RS |
||||
WHERE number = 9999; |
||||
.RE |
||||
EXEC SQL COMMIT; |
||||
.LP |
||||
.SH BUGS |
||||
.LP |
||||
The is no EXEC SQL PREPARE statement. |
||||
.LP |
||||
The complete structure definition MUST be listed |
||||
inside the declare section. |
||||
.LP |
||||
See the TODO file in the source for some more missing features. |
||||
.LP |
||||
.SH "RETURN VALUE" |
||||
.LP |
||||
ecpg returns 0 to the shell on successful completion, -1 |
||||
for errors. |
||||
.LP |
||||
.SH "SEE ALSO" |
||||
.PD 0 |
||||
.TP |
||||
\fIcc\fP(1), \fIpgintro\fP(l), \fIcommit\fP(l), \fIdelete\fP(l) |
||||
.TP |
||||
\fIfetch\fP(l), \fIselect\fP(l), \fIsql\fP(l) , \fIupdate\fP(l) |
||||
.PD |
||||
.SH FILES |
||||
.PD 0 |
||||
.TP |
||||
.B /usr/src/pgsql/postgresql-${ver}/src/interfaces... |
||||
./ecpg/include.......source for \fIecpg\fP header files. |
||||
./ecpg/lib...........source for \fIecpg\fP libraries. |
||||
./ecpg/preproc.......source for \fIecpg\fP header files. |
||||
./ecpg/test..........source for \fIecpg\fP libraries. |
||||
(test contains examples of syntax for ecpg SQL-C.) |
||||
.PD |
||||
.TP |
||||
.B /usr/local/pgsql/bin |
||||
\fIPostgreSQL\fP binaries including \fIecpg\fP. |
||||
.PD |
||||
.TP |
||||
.B /usr/local/pgsql/include |
||||
\fIPostgreSQL\fP headers including \fIecpglib.h\fP \fIecpgtype.h\fP |
||||
and \fIsqlca.h\fP. |
||||
.PD |
||||
.TP |
||||
.B /usr/local/pgsql/lib |
||||
\fIPostgreSQL\fP libraries including \fIlibecpg.a\fP and |
||||
\fIlibecpg.so\fP. |
||||
.SH AUTHORS |
||||
Linus Tolke \fI<linus@epact.se>\fP |
||||
- original author of ECPG (up to version 0.2). |
||||
.br |
||||
.PP |
||||
Michael Meskes \fI<meskes@debian.org>\fP |
||||
- actual author and maintainer of ECPG. |
||||
.br |
||||
.PP |
||||
Thomas Good \fI<tomg@q8.nrnet.org>\fP |
||||
- author of this revision of the ecpg man page. |
||||
.br |
||||
.zZ |
||||
--> |
||||
|
||||
</para> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
||||
@ -0,0 +1,170 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/end.sgml,v 1.1 1999/07/22 15:09:11 thomas Exp $ |
||||
Postgres documentation |
||||
--> |
||||
|
||||
<refentry id="SQL-END"> |
||||
<refmeta> |
||||
<refentrytitle id="SQL-END-TITLE"> |
||||
END |
||||
</refentrytitle> |
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
||||
</refmeta> |
||||
<refnamediv> |
||||
<refname> |
||||
END |
||||
</refname> |
||||
<refpurpose> |
||||
Commits the current transaction |
||||
</refpurpose> |
||||
</refnamediv> |
||||
|
||||
<refsynopsisdiv> |
||||
<refsynopsisdivinfo> |
||||
<date>1999-07-20</date> |
||||
</refsynopsisdivinfo> |
||||
<synopsis> |
||||
END [ WORK | TRANSACTION ] |
||||
</synopsis> |
||||
|
||||
<refsect2 id="R2-SQL-END-1"> |
||||
<refsect2info> |
||||
<date>1998-09-08</date> |
||||
</refsect2info> |
||||
<title> |
||||
Inputs |
||||
</title> |
||||
<para> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term>WORK</term> |
||||
<term>TRANSACTION</term> |
||||
<listitem> |
||||
<para> |
||||
Optional keywords. They have no effect. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</para> |
||||
</refsect2> |
||||
|
||||
<refsect2 id="R2-SQL-END-2"> |
||||
<refsect2info> |
||||
<date>1998-09-08</date> |
||||
</refsect2info> |
||||
<title> |
||||
Outputs |
||||
</title> |
||||
<para> |
||||
|
||||
<variablelist> |
||||
<varlistentry> |
||||
<term><computeroutput> |
||||
END |
||||
</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
Message returned if the transaction is successfully committed. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
<varlistentry> |
||||
<term><computeroutput> |
||||
NOTICE EndTransactionBlock and not inprogress/abort state |
||||
</computeroutput></term> |
||||
<listitem> |
||||
<para> |
||||
If there is no transaction in progress. |
||||
</para> |
||||
</listitem> |
||||
</varlistentry> |
||||
</variablelist> |
||||
</para> |
||||
</refsect2> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1 id="R1-SQL-END-1"> |
||||
<refsect1info> |
||||
<date>1998-09-08</date> |
||||
</refsect1info> |
||||
<title> |
||||
Description |
||||
</title> |
||||
|
||||
<para> |
||||
<command>END</command> is a <productname>Postgres</productname> |
||||
synonym for |
||||
<xref linkend="sql-commit-title" endterm="sql-commit-title">. |
||||
</para> |
||||
|
||||
<refsect2 id="R2-SQL-END-3"> |
||||
<refsect2info> |
||||
<date>1998-09-08</date> |
||||
</refsect2info> |
||||
<title> |
||||
Notes |
||||
</title> |
||||
<para> |
||||
The keywords WORK and TRANSACTION are noise and can be omitted. |
||||
</para> |
||||
|
||||
<para> |
||||
Use <xref linkend="SQL-ROLLBACK-TITLE" endterm="SQL-ROLLBACK-TITLE"> |
||||
to abort a transaction. |
||||
</para> |
||||
</refsect2> |
||||
</refsect1> |
||||
|
||||
<refsect1 id="R1-SQL-END-2"> |
||||
<title> |
||||
Usage |
||||
</title> |
||||
<para> |
||||
To make all changes permanent: |
||||
|
||||
<programlisting> |
||||
END WORK; |
||||
</programlisting> |
||||
</para> |
||||
</refsect1> |
||||
|
||||
<refsect1 id="R1-SQL-END-3"> |
||||
<title> |
||||
Compatibility |
||||
</title> |
||||
|
||||
<refsect2 id="R2-SQL-END-4"> |
||||
<refsect2info> |
||||
<date>1998-09-08</date> |
||||
</refsect2info> |
||||
<title> |
||||
SQL92 |
||||
</title> |
||||
|
||||
<para> |
||||
<command>END</command> is a <productname>Postgres</productname> |
||||
extension which provides functionality equivalent to |
||||
<xref linkend="sql-commit-title" endterm="sql-commit-title">. |
||||
</para> |
||||
</refsect2> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
||||
@ -0,0 +1,117 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/ipcclean.sgml,v 1.1 1999/07/22 15:09:12 thomas Exp $ |
||||
Postgres documentation |
||||
--> |
||||
|
||||
<refentry id="APP-IPCCLEAN"> |
||||
<refmeta> |
||||
<refentrytitle id="APP-IPCCLEAN-TITLE"> |
||||
<application>ipcclean</application> |
||||
</refentrytitle> |
||||
<refmiscinfo>Application</refmiscinfo> |
||||
</refmeta> |
||||
<refnamediv> |
||||
<refname> |
||||
<application>ipcclean</application> |
||||
</refname> |
||||
<refpurpose> |
||||
Clean up shared memory and semaphores from aborted backends |
||||
</refpurpose> |
||||
</refnamediv> |
||||
<refsynopsisdiv> |
||||
<refsynopsisdivinfo> |
||||
<date>1999-07-20</date> |
||||
</refsynopsisdivinfo> |
||||
<synopsis> |
||||
ipcclean |
||||
</synopsis> |
||||
|
||||
<refsect2 id="R2-APP-IPCCLEAN-1"> |
||||
<refsect2info> |
||||
<date>1999-07-20</date> |
||||
</refsect2info> |
||||
<title> |
||||
Inputs |
||||
</title> |
||||
<para> |
||||
None. |
||||
</para> |
||||
</refsect2> |
||||
|
||||
<refsect2 id="R2-APP-IPCCLEAN-2"> |
||||
<refsect2info> |
||||
<date>1999-07-30</date> |
||||
</refsect2info> |
||||
<title> |
||||
Outputs |
||||
</title> |
||||
<para> |
||||
None. |
||||
</para> |
||||
</refsect2> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1 id="R1-APP-IPCCLEAN-1"> |
||||
<refsect1info> |
||||
<date>1999-07-20</date> |
||||
</refsect1info> |
||||
<title> |
||||
Description |
||||
</title> |
||||
<para> |
||||
<application>ipcclean</application> |
||||
cleans up shared memory and semaphore space from aborted backends by |
||||
deleting all instances owned by user <literal>postgres</literal>. |
||||
Only the DBA |
||||
should execute this program as it can cause bizarre behavior (i.e., |
||||
crashes) if run during multi-user execution. This program should be |
||||
executed if messages such as |
||||
|
||||
<computeroutput> |
||||
semget: No space left on device |
||||
</computeroutput> |
||||
|
||||
are encountered when starting up the |
||||
<application>postmaster</application> or the backend server. |
||||
</para> |
||||
|
||||
<para> |
||||
If this command is executed while <application>postmaster</application> |
||||
is running, the shared memory and semaphores allocated by the |
||||
<application>postmaster</application> |
||||
will be deleted. This will result in a general failure of the |
||||
backends servers started by that |
||||
<application>postmaster</application>. |
||||
</para> |
||||
|
||||
<para> |
||||
This script is a hack, but in the many years since it was written, no |
||||
one has come up with an equally effective and portable solution. |
||||
Suggestions are welcome. |
||||
</para> |
||||
|
||||
<para> |
||||
The script makes assumption about the format of output of the |
||||
<application>ipcs</application> |
||||
utility which may not be true across different operating systems. |
||||
Therefore, it may not work on your particular OS. |
||||
</para> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
||||
@ -0,0 +1,170 @@ |
||||
<!-- |
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pg_passwd.sgml,v 1.1 1999/07/22 15:09:13 thomas Exp $ |
||||
Postgres documentation |
||||
--> |
||||
|
||||
<refentry id="APP-PG-PASSWD"> |
||||
<refmeta> |
||||
<refentrytitle id="APP-PG-PASSWD-TITLE"> |
||||
<application>pg_passwd</application> |
||||
</refentrytitle> |
||||
<refmiscinfo>Application</refmiscinfo> |
||||
</refmeta> |
||||
<refnamediv> |
||||
<refname> |
||||
<application>pg_passwd</application> |
||||
</refname> |
||||
<refpurpose> |
||||
Manipulate the flat password file |
||||
</refpurpose> |
||||
</refnamediv> |
||||
<refsynopsisdiv> |
||||
<refsynopsisdivinfo> |
||||
<date>1999-07-20</date> |
||||
</refsynopsisdivinfo> |
||||
<synopsis> |
||||
pg_passwd <replaceable class="parameter">filename</replaceable> |
||||
</synopsis> |
||||
</refsynopsisdiv> |
||||
|
||||
<refsect1 id="R1-APP-PG-PASSWD-1"> |
||||
<refsect1info> |
||||
<date>1999-07-20</date> |
||||
</refsect1info> |
||||
<title> |
||||
Description |
||||
</title> |
||||
<para> |
||||
<application>pg_passwd</application> |
||||
is a tool to manipulate the |
||||
flat password file functionality of |
||||
<productname>Postgres</productname>. This style of password |
||||
authentication is not <emphasis>required</emphasis> in an |
||||
installation, but is one of several supported security mechanisms. |
||||
</para> |
||||
|
||||
<para> |
||||
Specify the password file in the same style of |
||||
<literal>Ident</literal> authentication in |
||||
<filename>$PGDATA/pg_hba.conf</filename>: |
||||
|
||||
<programlisting> |
||||
host unv 133.65.96.250 255.255.255.255 password passwd |
||||
</programlisting> |
||||
|
||||
where the above line allows access from 133.65.96.250 using the passwords listed |
||||
in <filename>$PGDATA/passwd</filename>. |
||||
The format of the password file follows those of |
||||
<filename>/etc/passwd</filename> |
||||
and |
||||
<filename>/etc/shadow</filename>. |
||||
The first field is the user name, and the second field |
||||
is the encrypted password. |
||||
The rest is completely ignored. |
||||
Thus the following three sample lines specify the same user and password pair: |
||||
|
||||
<programlisting> |
||||
pg_guest:/nB7.w5Auq.BY:10031:::::: |
||||
pg_guest:/nB7.w5Auq.BY:93001:930::/home/guest:/bin/tcsh |
||||
pg_guest:/nB7.w5Auq.BY:93001 |
||||
</programlisting> |
||||
</para> |
||||
|
||||
<para> |
||||
Supply the password file to the pg_passwd command. |
||||
In the case described above, after changing the working directory to |
||||
<envar>PGDATA</envar>, the following command execution specify |
||||
the new password for <literal>pg_guest</literal>: |
||||
|
||||
<programlisting> |
||||
% pg_passwd passwd |
||||
Username: pg_guest |
||||
Password: |
||||
Re-enter password: |
||||
</programlisting> |
||||
|
||||
where the <literal>Password:</literal> |
||||
and <literal>Re-enter password:</literal> |
||||
prompts require the same password input which are not displayed |
||||
on the terminal. |
||||
The original password file is renamed to |
||||
<filename>passwd.bk</filename>. |
||||
</para> |
||||
|
||||
<para> |
||||
<application>psql</application> |
||||
uses the <option>-u</option> |
||||
option to invoke this style of |
||||
authentication. |
||||
</para> |
||||
|
||||
<para> |
||||
The following lines show the sample usage of the option: |
||||
|
||||
<programlisting> |
||||
% psql -h hyalos -u unv |
||||
Username: pg_guest |
||||
Password: |
||||
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: unv |
||||
unv=> |
||||
</programlisting> |
||||
</para> |
||||
|
||||
<para> |
||||
Perl5 authentication |
||||
uses the new style of the <filename>Pg.pm</filename> like this: |
||||
|
||||
<programlisting> |
||||
$conn = Pg::connectdb("host=hyalos dbname=unv |
||||
user=pg_guest password=xxxxxxx"); |
||||
</programlisting> |
||||
|
||||
For more details, refer to |
||||
<filename>src/interfaces/perl5/Pg.pm</filename>. |
||||
</para> |
||||
|
||||
<para> |
||||
Pg{tcl,tk}sh authentication |
||||
uses the |
||||
<function>pg_connect</function> |
||||
command with the |
||||
<option>-conninfo</option> |
||||
option thusly: |
||||
|
||||
<programlisting> |
||||
% set conn [pg_connect -conninfo \\ |
||||
"host=hyalos dbname=unv \\ |
||||
user=pg_guest password=xxxxxxx "] |
||||
</programlisting> |
||||
|
||||
You can list all of the keys for the option by executing the following |
||||
command: |
||||
|
||||
<programlisting> |
||||
% puts [ pg_conndefaults] |
||||
</programlisting> |
||||
</para> |
||||
</refsect1> |
||||
</refentry> |
||||
|
||||
<!-- Keep this comment at the end of the file |
||||
Local variables: |
||||
mode: sgml |
||||
sgml-omittag:nil |
||||
sgml-shorttag:t |
||||
sgml-minimize-attributes:nil |
||||
sgml-always-quote-attributes:t |
||||
sgml-indent-step:1 |
||||
sgml-indent-data:t |
||||
sgml-parent-document:nil |
||||
sgml-default-dtd-file:"../reference.ced" |
||||
sgml-exposed-tags:nil |
||||
sgml-local-catalogs:"/usr/lib/sgml/catalog" |
||||
sgml-local-ecat-files:nil |
||||
End: |
||||
--> |
||||
Loading…
Reference in new issue