Changed " to '. Removed bug section from psql. added reminder for log call
in built-in. fixed backslases in source for libpq.
This commit is contained in:
parent
54c9905d6e
commit
a180738ddd
@ -1,6 +1,6 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/built-in.3,v 1.1 1996/11/14 10:15:15 scrappy Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/built-in.3,v 1.2 1996/11/15 17:55:26 momjian Exp $
|
||||
.TH BUILT-INS INTRO 11/05/95 Postgres95 Postgres95
|
||||
.SH "DESCRIPTION"
|
||||
This section describes the data types, functions and operators
|
||||
@ -208,7 +208,7 @@ float8
|
||||
|/ square root
|
||||
||/ cube root
|
||||
: exponential function
|
||||
; natural logarithm
|
||||
; natural logarithm (in psql, protect with parentheses)
|
||||
|
||||
point
|
||||
!< A is left of B
|
||||
|
@ -1,7 +1,6 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /usr/local/devel/postgres/src/ref/RCS/large_objects.3pqsrc,v 1.12 1
|
||||
993/08/23 09:03:16 aoki Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/large_objects.3,v 1.2 1996/11/15 17:55:29 momjian Exp $
|
||||
.TH "LARGE OBJECTS" INTRO 03/18/94 Postgres95 Postgres95
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
@ -16,7 +15,6 @@ This section describes the implementation and the
|
||||
programmatic and query language interfaces to Postgres large object data.
|
||||
.PP
|
||||
.SH "Historical Note"
|
||||
.SH "Historical Note"
|
||||
.PP
|
||||
Originally, postgres 4.2 supports three standard implementations of large
|
||||
objects: as files external to Postgres, as Unix files managed by Postgres, and as
|
||||
@ -27,7 +25,6 @@ it provides stricter data integrity and time travel. For historical reasons,
|
||||
they are called Inversion large objects. (We will use Inversion and large
|
||||
objects interchangeably to mean the same thing in this section.)
|
||||
.SH "Inversion Large Objects"
|
||||
.SH "Inversion Large Objects"
|
||||
.PP
|
||||
The Inversion large
|
||||
object implementation breaks large objects up into \*(lqchunks\*(rq and
|
||||
@ -35,7 +32,6 @@ stores the chunks in tuples in the database. A B-tree index
|
||||
guarantees fast searches for the correct chunk number when doing
|
||||
random access reads and writes.
|
||||
.SH "Large Object Interfaces"
|
||||
.SH "Large Object Interfaces"
|
||||
.PP
|
||||
The facilities Postgres provides to access large objects, both in
|
||||
the backend as part of user-defined functions or the front end
|
||||
@ -77,7 +73,6 @@ Postgres provides a set of routines that
|
||||
support opening, reading, writing, closing, and seeking on large
|
||||
objects.
|
||||
.SH "Creating a Large Object"
|
||||
.SH "Creating a Large Object"
|
||||
.PP
|
||||
The routine
|
||||
.nf
|
||||
@ -114,7 +109,6 @@ The commands below create an (Inversion) large object:
|
||||
inv_oid = lo_creat(INV_READ|INV_WRITE|INV_ARCHIVE);
|
||||
.fi
|
||||
.SH "Importing a Large Object"
|
||||
.SH "Importing a Large Object"
|
||||
To import a UNIX file as a large object, call
|
||||
.nf
|
||||
Oid
|
||||
@ -125,7 +119,6 @@ The
|
||||
argument specifies the UNIX pathname of the file to be imported as
|
||||
a large object.
|
||||
.SH "Exporting a Large Object"
|
||||
.SH "Exporting a Large Object"
|
||||
To export a large object into UNIX file, call
|
||||
.nf
|
||||
int
|
||||
@ -138,7 +131,6 @@ the
|
||||
.I filename
|
||||
argument specifies the UNIX pathname of the file.
|
||||
.SH "Opening an Existing Large Object"
|
||||
.SH "Opening an Existing Large Object"
|
||||
.PP
|
||||
To open an existing large object, call
|
||||
.nf
|
||||
@ -165,7 +157,6 @@ and
|
||||
.B lo_close .
|
||||
.\"-----------
|
||||
.SH "Writing Data to a Large Object"
|
||||
.SH "Writing Data to a Large Object"
|
||||
.PP
|
||||
The routine
|
||||
.nf
|
||||
@ -187,7 +178,6 @@ The number of bytes actually written is returned.
|
||||
In the event of an error,
|
||||
the return value is negative.
|
||||
.SH "Seeking on a Large Object"
|
||||
.SH "Seeking on a Large Object"
|
||||
.PP
|
||||
To change the current read or write location on a large object,
|
||||
call
|
||||
@ -207,7 +197,6 @@ and
|
||||
.SM SEEK_END.
|
||||
.\"-----------
|
||||
.SH "Closing a Large Object Descriptor"
|
||||
.SH "Closing a Large Object Descriptor"
|
||||
.PP
|
||||
A large object may be closed by calling
|
||||
.nf
|
||||
@ -223,7 +212,6 @@ On success,
|
||||
returns zero. On error, the return value is negative.
|
||||
.PP
|
||||
.SH "Built in registered functions"
|
||||
.SH "Built in registered functions"
|
||||
.PP
|
||||
There are two built-in registered functions,
|
||||
.I lo_import
|
||||
@ -241,12 +229,11 @@ CREATE TABLE image (
|
||||
INSERT INTO image (name, raster)
|
||||
VALUES ('beautiful image', lo_import('/etc/motd'));
|
||||
|
||||
SELECT lo_export(image.raster, "/tmp/motd") from image
|
||||
SELECT lo_export(image.raster, '/tmp/motd') from image
|
||||
WHERE name = 'beautiful image';
|
||||
.fi
|
||||
.PP
|
||||
.SH "Accessing Large Objects from LIBPQ"
|
||||
.SH "Accessing Large Objects from LIBPQ"
|
||||
Below is a sample program which shows how the large object interface in
|
||||
\*(LP can be used. Parts of the program are commented out but are left
|
||||
in the source for the readers benefit. This program can be found in
|
||||
@ -262,7 +249,6 @@ and link with the
|
||||
library.
|
||||
.bp
|
||||
.SH "Sample Program"
|
||||
.SH "Sample Program"
|
||||
.nf
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
@ -273,7 +259,7 @@ library.
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/man/Attic/large_objects.3,v 1.1 1996/11/14 10:17:24 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/man/Attic/large_objects.3,v 1.2 1996/11/15 17:55:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -301,7 +287,7 @@ Oid importFile(PGconn *conn, char *filename)
|
||||
*/
|
||||
fd = open(filename, O_RDONLY, 0666);
|
||||
if (fd < 0) { /* error */
|
||||
fprintf(stderr, "can't open unix file\"%s\"\n", filename);
|
||||
fprintf(stderr, "can't open unix file\\"%s\\"\\n", filename);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -319,7 +305,7 @@ Oid importFile(PGconn *conn, char *filename)
|
||||
while ((nbytes = read(fd, buf, BUFSIZE)) > 0) {
|
||||
tmp = lo_write(conn, lobj_fd, buf, nbytes);
|
||||
if (tmp < nbytes) {
|
||||
fprintf(stderr, "error while reading \"%s\"", filename);
|
||||
fprintf(stderr, "error while reading \\"%s\\"", filename);
|
||||
}
|
||||
}
|
||||
|
||||
@ -348,11 +334,11 @@ void pickout(PGconn *conn, Oid lobjId, int start, int len)
|
||||
nread = 0;
|
||||
while (len - nread > 0) {
|
||||
nbytes = lo_read(conn, lobj_fd, buf, len - nread);
|
||||
buf[nbytes] = '\0';
|
||||
buf[nbytes] = '\\0';
|
||||
fprintf(stderr,">>> %s", buf);
|
||||
nread += nbytes;
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr,"\\n");
|
||||
lo_close(conn, lobj_fd);
|
||||
}
|
||||
|
||||
@ -375,14 +361,14 @@ void overwrite(PGconn *conn, Oid lobjId, int start, int len)
|
||||
|
||||
for (i=0;i<len;i++)
|
||||
buf[i] = 'X';
|
||||
buf[i] = '\0';
|
||||
buf[i] = '\\0';
|
||||
|
||||
nwritten = 0;
|
||||
while (len - nwritten > 0) {
|
||||
nbytes = lo_write(conn, lobj_fd, buf + nwritten, len - nwritten);
|
||||
nwritten += nbytes;
|
||||
}
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr,"\\n");
|
||||
lo_close(conn, lobj_fd);
|
||||
}
|
||||
|
||||
@ -413,7 +399,7 @@ void exportFile(PGconn *conn, Oid lobjId, char *filename)
|
||||
*/
|
||||
fd = open(filename, O_CREAT|O_WRONLY, 0666);
|
||||
if (fd < 0) { /* error */
|
||||
fprintf(stderr, "can't open unix file\"%s\"",
|
||||
fprintf(stderr, "can't open unix file\\"%s\\"",
|
||||
filename);
|
||||
}
|
||||
|
||||
@ -423,7 +409,7 @@ void exportFile(PGconn *conn, Oid lobjId, char *filename)
|
||||
while ((nbytes = lo_read(conn, lobj_fd, buf, BUFSIZE)) > 0) {
|
||||
tmp = write(fd, buf, nbytes);
|
||||
if (tmp < nbytes) {
|
||||
fprintf(stderr,"error while writing \"%s\"",
|
||||
fprintf(stderr,"error while writing \\"%s\\"",
|
||||
filename);
|
||||
}
|
||||
}
|
||||
@ -451,7 +437,7 @@ main(int argc, char **argv)
|
||||
PGresult *res;
|
||||
|
||||
if (argc != 4) {
|
||||
fprintf(stderr, "Usage: %s database_name in_filename out_filename\n",
|
||||
fprintf(stderr, "Usage: %s database_name in_filename out_filename\\n",
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
@ -467,27 +453,27 @@ main(int argc, char **argv)
|
||||
|
||||
/* check to see that the backend connection was successfully made */
|
||||
if (PQstatus(conn) == CONNECTION_BAD) {
|
||||
fprintf(stderr,"Connection to database '%s' failed.\n", database);
|
||||
fprintf(stderr,"Connection to database '%s' failed.\\n", database);
|
||||
fprintf(stderr,"%s",PQerrorMessage(conn));
|
||||
exit_nicely(conn);
|
||||
}
|
||||
|
||||
res = PQexec(conn, "begin");
|
||||
PQclear(res);
|
||||
printf("importing file \"%s\" ...\n", in_filename);
|
||||
printf("importing file \\"%s\\" ...\\n", in_filename);
|
||||
/* lobjOid = importFile(conn, in_filename); */
|
||||
lobjOid = lo_import(conn, in_filename);
|
||||
/*
|
||||
printf("\tas large object %d.\n", lobjOid);
|
||||
printf("\\tas large object %d.\\n", lobjOid);
|
||||
|
||||
printf("picking out bytes 1000-2000 of the large object\n");
|
||||
printf("picking out bytes 1000-2000 of the large object\\n");
|
||||
pickout(conn, lobjOid, 1000, 1000);
|
||||
|
||||
printf("overwriting bytes 1000-2000 of the large object with X's\n");
|
||||
printf("overwriting bytes 1000-2000 of the large object with X's\\n");
|
||||
overwrite(conn, lobjOid, 1000, 1000);
|
||||
*/
|
||||
|
||||
printf("exporting large object to file \"%s\" ...\n", out_filename);
|
||||
printf("exporting large object to file \\"%s\\" ...\\n", out_filename);
|
||||
/* exportFile(conn, lobjOid, out_filename); */
|
||||
lo_export(conn, lobjOid,out_filename);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/libpq.3,v 1.1 1996/11/14 10:17:26 scrappy Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/libpq.3,v 1.2 1996/11/15 17:55:30 momjian Exp $
|
||||
.TH LIBPQ INTRO 03/12/94 Postgres95 Postgres95
|
||||
.SH DESCRIPTION
|
||||
Libpq is the programmer's interface to Postgres. Libpq is a set of
|
||||
@ -469,7 +469,7 @@ returns EOF at EOF, 0 if the entire line has been read, and 1 if the
|
||||
buffer is full but the terminating newline has not yet been read.
|
||||
.IP
|
||||
Notice that the application must check to see if a new line consists
|
||||
of the single character \*(lq.\*(rq, which indicates that the backend
|
||||
of the characters \*(lq\\.\*(rq, which indicates that the backend
|
||||
server has finished sending the results of the
|
||||
.I copy
|
||||
command. Therefore, if the application ever expects to receive lines
|
||||
@ -645,7 +645,7 @@ main()
|
||||
|
||||
/* check to see that the backend connection was successfully made */
|
||||
if (PQstatus(conn) == CONNECTION_BAD) {
|
||||
fprintf(stderr,"Connection to database '%s' failed.\n", dbName);
|
||||
fprintf(stderr,"Connection to database '%s' failed.\\n", dbName);
|
||||
fprintf(stderr,"%s",PQerrorMessage(conn));
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -656,7 +656,7 @@ main()
|
||||
/* start a transaction block */
|
||||
res = PQexec(conn,"BEGIN");
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
fprintf(stderr,"BEGIN command failed\n");
|
||||
fprintf(stderr,"BEGIN command failed\\n");
|
||||
PQclear(res);
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -667,7 +667,7 @@ main()
|
||||
/* fetch instances from the pg_database, the system catalog of databases*/
|
||||
res = PQexec(conn,"DECLARE mycursor CURSOR FOR select * from pg_database");
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
fprintf(stderr,"DECLARE CURSOR command failed\n");
|
||||
fprintf(stderr,"DECLARE CURSOR command failed\\n");
|
||||
PQclear(res);
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -675,7 +675,7 @@ main()
|
||||
|
||||
res = PQexec(conn,"FETCH ALL in mycursor");
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
|
||||
fprintf(stderr,"FETCH ALL command didn't return tuples properly\n");
|
||||
fprintf(stderr,"FETCH ALL command didn't return tuples properly\\n");
|
||||
PQclear(res);
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -685,14 +685,14 @@ main()
|
||||
for (i=0; i < nFields; i++) {
|
||||
printf("%-15s",PQfname(res,i));
|
||||
}
|
||||
printf("\n\n");
|
||||
printf("\\n\\n");
|
||||
|
||||
/* next, print out the instances */
|
||||
for (i=0; i < PQntuples(res); i++) {
|
||||
for (j=0 ; j < nFields; j++) {
|
||||
printf("%-15s", PQgetvalue(res,i,j));
|
||||
}
|
||||
printf("\n");
|
||||
printf("\\n");
|
||||
}
|
||||
|
||||
PQclear(res);
|
||||
@ -770,14 +770,14 @@ main()
|
||||
|
||||
/* check to see that the backend connection was successfully made */
|
||||
if (PQstatus(conn) == CONNECTION_BAD) {
|
||||
fprintf(stderr,"Connection to database '%s' failed.\n", dbName);
|
||||
fprintf(stderr,"Connection to database '%s' failed.\\n", dbName);
|
||||
fprintf(stderr,"%s",PQerrorMessage(conn));
|
||||
exit_nicely(conn);
|
||||
}
|
||||
|
||||
res = PQexec(conn, "LISTEN TBL2");
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
fprintf(stderr,"LISTEN command failed\n");
|
||||
fprintf(stderr,"LISTEN command failed\\n");
|
||||
PQclear(res);
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -789,12 +789,12 @@ main()
|
||||
/* async notification only come back as a result of a query*/
|
||||
/* we can send empty queries */
|
||||
res = PQexec(conn, " ");
|
||||
/* printf("res->status = %s\n", pgresStatus[PQresultStatus(res)]); */
|
||||
/* printf("res->status = %s\\n", pgresStatus[PQresultStatus(res)]); */
|
||||
/* check for asynchronous returns */
|
||||
notify = PQnotifies(conn);
|
||||
if (notify) {
|
||||
fprintf(stderr,
|
||||
"ASYNC NOTIFY of '%s' from backend pid '%d' received\n",
|
||||
"ASYNC NOTIFY of '%s' from backend pid '%d' received\\n",
|
||||
notify->relname, notify->be_pid);
|
||||
free(notify);
|
||||
break;
|
||||
@ -876,7 +876,7 @@ main()
|
||||
|
||||
/* check to see that the backend connection was successfully made */
|
||||
if (PQstatus(conn) == CONNECTION_BAD) {
|
||||
fprintf(stderr,"Connection to database '%s' failed.\n", dbName);
|
||||
fprintf(stderr,"Connection to database '%s' failed.\\n", dbName);
|
||||
fprintf(stderr,"%s",PQerrorMessage(conn));
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -884,7 +884,7 @@ main()
|
||||
/* start a transaction block */
|
||||
res = PQexec(conn,"BEGIN");
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
fprintf(stderr,"BEGIN command failed\n");
|
||||
fprintf(stderr,"BEGIN command failed\\n");
|
||||
PQclear(res);
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -895,7 +895,7 @@ main()
|
||||
/* fetch instances from the pg_database, the system catalog of databases*/
|
||||
res = PQexec(conn,"DECLARE mycursor BINARY CURSOR FOR select * from test1");
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
fprintf(stderr,"DECLARE CURSOR command failed\n");
|
||||
fprintf(stderr,"DECLARE CURSOR command failed\\n");
|
||||
PQclear(res);
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -903,7 +903,7 @@ main()
|
||||
|
||||
res = PQexec(conn,"FETCH ALL in mycursor");
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
|
||||
fprintf(stderr,"FETCH ALL command didn't return tuples properly\n");
|
||||
fprintf(stderr,"FETCH ALL command didn't return tuples properly\\n");
|
||||
PQclear(res);
|
||||
exit_nicely(conn);
|
||||
}
|
||||
@ -913,7 +913,7 @@ main()
|
||||
p_fnum = PQfnumber(res,"p");
|
||||
|
||||
for (i=0;i<3;i++) {
|
||||
printf("type[%d] = %d, size[%d] = %d\n",
|
||||
printf("type[%d] = %d, size[%d] = %d\\n",
|
||||
i, PQftype(res,i),
|
||||
i, PQfsize(res,i));
|
||||
}
|
||||
@ -931,12 +931,12 @@ main()
|
||||
pval = (POLYGON*) malloc(plen + VARHDRSZ);
|
||||
pval->size = plen;
|
||||
memmove((char*)&pval->npts, PQgetvalue(res,i,p_fnum), plen);
|
||||
printf("tuple %d: got\n", i);
|
||||
printf(" i = (%d bytes) %d,\n",
|
||||
printf("tuple %d: got\\n", i);
|
||||
printf(" i = (%d bytes) %d,\\n",
|
||||
PQgetlength(res,i,i_fnum), *ival);
|
||||
printf(" d = (%d bytes) %f,\n",
|
||||
printf(" d = (%d bytes) %f,\\n",
|
||||
PQgetlength(res,i,d_fnum), *dval);
|
||||
printf(" p = (%d bytes) %d points \tboundbox = (hi=%f/%f, lo = %f,%f)\n",
|
||||
printf(" p = (%d bytes) %d points \\tboundbox = (hi=%f/%f, lo = %f,%f)\\n",
|
||||
PQgetlength(res,i,d_fnum),
|
||||
pval->npts,
|
||||
pval->boundbox.xh,
|
||||
@ -960,3 +960,4 @@ main()
|
||||
|
||||
}
|
||||
.fi
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.1 1996/11/14 10:17:50 scrappy Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.2 1996/11/15 17:55:31 momjian Exp $
|
||||
.TH PSQL UNIX 1/20/96 Postgres95 Postgres95
|
||||
.SH NAME
|
||||
psql \(em run the interactive query front-end
|
||||
@ -343,7 +343,8 @@ When executed with the
|
||||
.BR "-c"
|
||||
option,
|
||||
.IR psql
|
||||
returns 0 to the shell on successful query completion, 1 otherwise.
|
||||
returns 0 to the shell on successful query completion, 1 for errors,
|
||||
2 for abrupt disconnection from the backend.
|
||||
.IR psql
|
||||
will also return 1 if the connection to a database could not be made for
|
||||
any reason.
|
||||
@ -352,8 +353,3 @@ introduction(libpq),
|
||||
monitor(1)
|
||||
postgres(1),
|
||||
postmaster(1).
|
||||
.SH BUGS
|
||||
If multiple queries are sent to the backend at once without semicolon
|
||||
termination after each query, psql gets confused about the query
|
||||
results. The queries will still be processed correctly by the backend.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user