Commit 6c498285 authored by Marc G. Fournier's avatar Marc G. Fournier

parent 6f3de1bb
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.86 1998/08/25 21:34:04 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.87 1998/08/30 21:05:27 scrappy Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -443,11 +443,41 @@ pg_parse_and_plan(char *query_string, /* string to execute */ ...@@ -443,11 +443,41 @@ pg_parse_and_plan(char *query_string, /* string to execute */
querytree = querytree_list->qtrees[i]; querytree = querytree_list->qtrees[i];
if (DebugPrintQuery == true) if (DebugPrintQuery)
{ {
printf("\n---- \tquery is:\n%s\n", query_string); if (DebugPrintQuery > 3) {
printf("\n"); /* Print the query string as is if query debug level > 3 */
fflush(stdout); TPRINTF(TRACE_QUERY, "query: %s",query_string);
} else {
/* Print condensed query string to fit in one log line */
char buff[8192+1];
char c,
*s,
*d;
int n,
is_space=1;
for (s=query_string,d=buff,n=0; (c=*s) && (n<8192); s++) {
switch (c) {
case '\r':
case '\n':
case '\t':
c = ' ';
/* fall through */
case ' ':
if (is_space) continue;
is_space = 1;
break;
default:
is_space = 0;
break;
}
*d++ = c;
n++;
}
*d = '\0';
TPRINTF(TRACE_QUERY, "query: %s",buff);
}
} }
/* don't rewrite utilites */ /* don't rewrite utilites */
...@@ -457,11 +487,10 @@ pg_parse_and_plan(char *query_string, /* string to execute */ ...@@ -457,11 +487,10 @@ pg_parse_and_plan(char *query_string, /* string to execute */
continue; continue;
} }
if (DebugPrintParse == true) if (DebugPrintParse)
{ {
printf("\n---- \tparser outputs :\n"); TPRINTF(TRACE_PARSE, "parser outputs:");
nodeDisplay(querytree); nodeDisplay(querytree);
printf("\n");
} }
/* rewrite queries (retrieve, append, delete, replace) */ /* rewrite queries (retrieve, append, delete, replace) */
...@@ -906,8 +935,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -906,8 +935,10 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
char firstchar; char firstchar;
char parser_input[MAX_PARSE_BUFFER]; char parser_input[MAX_PARSE_BUFFER];
char *userName; char *userName;
char *remote_info;
char *remote_host; /* Used if verbose is set, must be initialized */
char *remote_info = "interactive";
char *remote_host = "";
unsigned short remote_port = 0; unsigned short remote_port = 0;
char *DBDate = NULL; char *DBDate = NULL;
...@@ -1490,7 +1521,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1490,7 +1521,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface"); puts("\nPOSTGRES backend interactive interface");
puts("$Revision: 1.86 $ $Date: 1998/08/25 21:34:04 $"); puts("$Revision: 1.87 $ $Date: 1998/08/30 21:05:27 $");
} }
/* ---------------- /* ----------------
......
.\" This is -*-nroff-*- .\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here.... .\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.5 1998/07/14 01:45:25 momjian Exp $ .\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.6 1998/08/30 21:03:19 scrappy Exp $
.TH "CREATE SEQUENCE" SQL 07/13/98 PostgreSQL PostgreSQL .TH "CREATE SEQUENCE" SQL 07/13/98 PostgreSQL PostgreSQL
.SH NAME .SH NAME
create sequence - create a new sequence number generator create sequence - create a new sequence number generator
...@@ -82,6 +82,14 @@ given sequence in the current backend session. Also beware that it ...@@ -82,6 +82,14 @@ given sequence in the current backend session. Also beware that it
does not give the last number ever allocated, only the last one allocated does not give the last number ever allocated, only the last one allocated
by this backend. by this backend.
.PP .PP
The function
.BR setval
('sequence_name', value)
may be used to set the current value of the specified sequence.
The next call to
.BR nextval
will return the given value + the sequence increment.
.PP
Use a query like Use a query like
.nf .nf
SELECT * FROM <sequence_name>; SELECT * FROM <sequence_name>;
...@@ -134,6 +142,15 @@ select nextval ('seq'); ...@@ -134,6 +142,15 @@ select nextval ('seq');
-- Use sequence in insert -- Use sequence in insert
-- --
insert into table _table_ values (nextval ('seq'),...); insert into table _table_ values (nextval ('seq'),...);
.nf
--
-- Set the sequence value after a copy in
--
create function table_id_max() returns int4
as 'select max(id) from _table_'
language 'sql';
copy _table_ from 'input_file';
select setval('seq', table_id_max());
.fi .fi
.SH "SEE ALSO" .SH "SEE ALSO"
drop_sequence(l). drop_sequence(l).
.\" This is -*-nroff-*- .\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here.... .\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/listen.l,v 1.7 1998/07/09 03:29:09 scrappy Exp $ .\" $Header: /cvsroot/pgsql/src/man/Attic/listen.l,v 1.8 1998/08/30 21:03:20 scrappy Exp $
.TH "LISTEN" SQL 03/12/94 PostgreSQL PostgreSQL .TH "LISTEN" SQL 03/12/94 PostgreSQL PostgreSQL
.SH NAME .SH NAME
listen - listen for notification on a relation listen - listen for notification on a relation
...@@ -27,16 +27,19 @@ in order to find out the name of the class to which a given ...@@ -27,16 +27,19 @@ in order to find out the name of the class to which a given
notification corresponds. If this code is not included in notification corresponds. If this code is not included in
the application, the event notification will be queued and the application, the event notification will be queued and
never be processed. never be processed.
.PP
Note that
.IR class_name
needs not to be a valid class name but can be any ascii string up to 32
characters long. It must however be eclosed in double-quotes if it is
not valid as class name.
.SH "SEE ALSO" .SH "SEE ALSO"
create_rule(l), create_rule(l),
notify(l), notify(l),
select(l), select(l),
unlisten(l),
libpq. libpq.
.SH BUGS .SH BUGS
There is no way to un-\c
.BR listen
except to drop the connection (i.e., restart the backend server).
.PP
The The
.IR psql(1) .IR psql(1)
command does not poll for asynchronous events. command does not poll for asynchronous events.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment