1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

The patch does several things:

It adds a WITH OIDS option to the copy command, which allows
dumping and loading of oids.

        If a copy command tried to load in an oid that is greater than
its current system max oid, the system max oid is incremented.  No
checking is done to see if other backends are running and have cached
oids.

        pg_dump as its first step when using the -o (oid) option, will
copy in a dummy row to set the system max oid value so as rows are
loaded in, they are certain to be lower than the system oid.

        pg_dump now creates indexes at the end to speed loading


Submitted by:  Bruce Momjian <maillist@candle.pha.pa.us>
This commit is contained in:
Marc G. Fournier
1996-08-24 20:49:41 +00:00
parent 2adb6d703b
commit 208a30f23d
13 changed files with 254 additions and 83 deletions

View File

@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.7 1996/08/15 07:42:29 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.8 1996/08/24 20:48:44 scrappy Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -122,14 +122,14 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr);
%type <list> queryblock, relation_name_list, OptTableElementList,
tableElementList, OptInherit, definition,
opt_with, def_args, def_name_list, func_argtypes, oper_argtypes,
opt_with_func, def_args, def_name_list, func_argtypes, oper_argtypes,
OptStmtList, OptStmtBlock, opt_column_list, columnList,
exprList, sort_clause, sortby_list, index_params,
name_list, from_clause, from_list, opt_array_bounds, nest_array_bounds,
expr_list, attrs, res_target_list, res_target_list2, def_list,
opt_indirection, group_clause, groupby_list, explain_options
%type <boolean> opt_inh_star, opt_binary, opt_instead
%type <boolean> opt_inh_star, opt_binary, opt_instead, opt_with_copy
%type <ival> copy_dirn, archive_type, OptArchiveType, OptArchiveLocation,
def_type, opt_direction, remove_type, opt_column, event
@ -176,7 +176,7 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr);
HAVING, HEAVY, IN, INDEX, INHERITS, INSERT, INSTEAD, INTO, IS,
ISNULL, LANGUAGE, LIGHT, LISTEN, LOAD, MERGE, MOVE, NEW,
NONE, NOT, NOTHING, NOTIFY, NOTNULL,
ON, OPERATOR, OPTION, OR, ORDER,
OIDS, ON, OPERATOR, OPTION, OR, ORDER,
PNULL, PRIVILEGES, PUBLIC, PURGE, P_TYPE,
RENAME, REPLACE, RETRIEVE, RETURNS, REVOKE, ROLLBACK, RULE,
SELECT, SET, SETOF, STDIN, STDOUT, STORE,
@ -306,14 +306,15 @@ ClosePortalStmt: CLOSE opt_id
*
*****************************************************************************/
CopyStmt: COPY opt_binary relation_name copy_dirn copy_file_name copy_delimiter
CopyStmt: COPY opt_binary relation_name opt_with_copy copy_dirn copy_file_name copy_delimiter
{
CopyStmt *n = makeNode(CopyStmt);
n->binary = $2;
n->relname = $3;
n->direction = $4;
n->filename = $5;
n->delimiter = $6;
n->oids = $4;
n->direction = $5;
n->filename = $6;
n->delimiter = $7;
$$ = (Node *)n;
}
;
@ -338,6 +339,10 @@ opt_binary: BINARY { $$ = TRUE; }
| /*EMPTY*/ { $$ = FALSE; }
;
opt_with_copy: WITH OIDS { $$ = TRUE; }
| /* EMPTY */ { $$ = FALSE; }
;
/*
* the default copy delimiter is tab but the user can configure it
*/
@ -725,7 +730,7 @@ RecipeStmt: EXECUTE RECIPE recipe_name
*****************************************************************************/
ProcedureStmt: CREATE FUNCTION def_name def_args
RETURNS def_arg opt_with AS Sconst LANGUAGE Sconst
RETURNS def_arg opt_with_func AS Sconst LANGUAGE Sconst
{
ProcedureStmt *n = makeNode(ProcedureStmt);
n->funcname = $3;
@ -737,7 +742,7 @@ ProcedureStmt: CREATE FUNCTION def_name def_args
$$ = (Node *)n;
};
opt_with: WITH definition { $$ = $2; }
opt_with_func: WITH definition { $$ = $2; }
| /* EMPTY */ { $$ = NIL; }
;

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.2 1996/08/06 16:43:08 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.3 1996/08/24 20:48:46 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@ -103,6 +103,7 @@ static ScanKeyword ScanKeywords[] = {
{ "notify", NOTIFY },
{ "notnull", NOTNULL },
{ "null", PNULL },
{ "oids", OIDS },
{ "on", ON },
{ "operator", OPERATOR },
{ "option", OPTION },