diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 52158c75e6caa5b1cd3cc95d3f9e70817b9ac684..2592b2bec05635f0334702514076075e8ced717b 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.59 1998/01/31 04:38:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.60 1998/02/03 19:26:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -135,7 +135,9 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec) pmem = PortalGetVariableMemory(vc_portal); old = MemoryContextSwitchTo((MemoryContext) pmem); - Assert(va_spec == NIL || analyze); + if (va_spec == NIL || analyze) + elog(ERROR,"Can't vacuum columns, only tables. You can 'vacuum analyze' columns."); + foreach(le, va_spec) { char *col = (char *) lfirst(le); diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 5a847de14da31e834a8e50c97812a6f94965d240..b3a6f73095b5b321aa71729995f57a9f539733fd 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.102 1998/02/03 16:04:02 thomas Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.103 1998/02/03 19:26:41 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -2916,6 +2916,76 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')' n->subselect = $7; $$ = (Node *)n; } + | '(' row_descriptor ')' '+' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("+",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '-' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("-",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '/' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("/",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '*' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '<' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("<",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '>' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons(">",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '=' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("=",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } | '(' row_descriptor ')' Op ALL '(' SubSelect ')' { SubLink *n = makeNode(SubLink); @@ -2926,6 +2996,76 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')' n->subselect = $7; $$ = (Node *)n; } + | '(' row_descriptor ')' '+' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("+",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '-' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("-",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '/' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("/",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '*' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '<' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("<",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '>' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons(">",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '=' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("=",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $7; + $$ = (Node *)n; + } | '(' row_descriptor ')' Op '(' SubSelect ')' { SubLink *n = makeNode(SubLink); @@ -2939,10 +3079,108 @@ row_expr: '(' row_descriptor ')' IN '(' SubSelect ')' n->subselect = $6; $$ = (Node *)n; } + | '(' row_descriptor ')' '+' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("+", NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $6; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '-' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("-", NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $6; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '/' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("/", NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $6; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '*' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("*", NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $6; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '<' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("<", NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $6; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '>' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons(">", NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $6; + $$ = (Node *)n; + } + | '(' row_descriptor ')' '=' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = $2; + n->oper = lcons("=", NIL); + n->useor = false; + n->subLinkType = EXPR_SUBLINK; + n->subselect = $6; + $$ = (Node *)n; + } | '(' row_descriptor ')' Op '(' row_descriptor ')' { $$ = makeRowExpr($4, $2, $6); } + | '(' row_descriptor ')' '+' '(' row_descriptor ')' + { + $$ = makeRowExpr("+", $2, $6); + } + | '(' row_descriptor ')' '-' '(' row_descriptor ')' + { + $$ = makeRowExpr("-", $2, $6); + } + | '(' row_descriptor ')' '/' '(' row_descriptor ')' + { + $$ = makeRowExpr("/", $2, $6); + } + | '(' row_descriptor ')' '*' '(' row_descriptor ')' + { + $$ = makeRowExpr("*", $2, $6); + } + | '(' row_descriptor ')' '<' '(' row_descriptor ')' + { + $$ = makeRowExpr("<", $2, $6); + } + | '(' row_descriptor ')' '>' '(' row_descriptor ')' + { + $$ = makeRowExpr(">", $2, $6); + } + | '(' row_descriptor ')' '=' '(' row_descriptor ')' + { + $$ = makeRowExpr("=", $2, $6); + } ; row_descriptor: row_list ',' a_expr @@ -3320,6 +3558,76 @@ a_expr: attr opt_indirection n->subselect = $5; $$ = (Node *)n; } + | a_expr '+' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons("+",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '-' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons("-",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '/' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons("/",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '*' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '<' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons("<",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '>' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons(">",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '=' ANY '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1,NIL); + n->oper = lcons("=",NIL); + n->useor = false; + n->subLinkType = ANY_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } | a_expr Op ALL '(' SubSelect ')' { SubLink *n = makeNode(SubLink); @@ -3330,6 +3638,76 @@ a_expr: attr opt_indirection n->subselect = $5; $$ = (Node *)n; } + | a_expr '+' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("+",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '-' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("-",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '/' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("/",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '*' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '<' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("<",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '>' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons(">",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } + | a_expr '=' ALL '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("=",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $5; + $$ = (Node *)n; + } | a_expr Op '(' SubSelect ')' { SubLink *n = makeNode(SubLink); @@ -3340,6 +3718,76 @@ a_expr: attr opt_indirection n->subselect = $4; $$ = (Node *)n; } + | a_expr '+' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("+",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } + | a_expr '-' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("-",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } + | a_expr '/' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("/",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } + | a_expr '*' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("*",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } + | a_expr '<' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("<",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } + | a_expr '>' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons(">",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } + | a_expr '=' '(' SubSelect ')' + { + SubLink *n = makeNode(SubLink); + n->lefthand = lcons($1, NULL); + n->oper = lcons("=",NIL); + n->useor = false; + n->subLinkType = ALL_SUBLINK; + n->subselect = $4; + $$ = (Node *)n; + } | a_expr AND a_expr { $$ = makeA_Expr(AND, NULL, $1, $3); } | a_expr OR a_expr diff --git a/src/bin/psql/psqlHelp.h b/src/bin/psql/psqlHelp.h index d273929c4aba2b5c9fe751d688d8ad6ca41473a0..4990a241508c242d6961808c773c6ac322fc146d 100644 --- a/src/bin/psql/psqlHelp.h +++ b/src/bin/psql/psqlHelp.h @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: psqlHelp.h,v 1.39 1998/01/22 23:05:09 momjian Exp $ + * $Id: psqlHelp.h,v 1.40 1998/02/03 19:27:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -292,9 +292,10 @@ set R_PLANS to {'ON' | 'OFF'}"}, "update <class_name> set <attr1>=<expr1>,...<attrN>=<exprN> [from <from_clause>] [where <qual>];"}, {"vacuum", "vacuum the database, i.e. cleans out deleted records, updates statistics", - "vacuum [verbose] [analyze]\n\ + "\ +vacuum [verbose] [analyze] [table]\n\ \tor\n\ -vacuum [verbose] [analyze] table [analyze [(attr1, ... attrN)] ];"}, +vacuum [verbose] analyze [table [(attr1, ... attrN)]];"}, {NULL, NULL, NULL} /* important to keep a NULL terminator * here! */ }; diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index af76a37d553dd3203a88495fd548b7e7c995c7c1..ccd70a0afe99bbf4dd32b2a2a709a4717678deb9 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_type.h,v 1.29 1998/02/03 01:53:24 momjian Exp $ + * $Id: pg_type.h,v 1.30 1998/02/03 19:27:17 momjian Exp $ * * NOTES * the genbki.sh script reads this file and generates .bki @@ -366,7 +366,7 @@ DESCR("limited-range ISO-format date and time"); #define USE_ATTTYPMOD(typeid) ((typeid) == BPCHAROID || (typeid) == VARCHAROID) -#define VARLENA_FIXED_SIZE(typeid) ((typeid) == BPCHAROID) +#define VARLENA_FIXED_SIZE(attr) (false && (attr)->atttypid == BPCHAROID && (attr)->atttypmod > 0) /* * prototypes for functions in pg_type.c diff --git a/src/man/vacuum.l b/src/man/vacuum.l index e3d438f7a1ed703049517a450e625faa3d0d1710..cbef19725b1809f90b54d0f03df804488f945f93 100644 --- a/src/man/vacuum.l +++ b/src/man/vacuum.l @@ -1,12 +1,13 @@ .\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... -.\" $Header: /cvsroot/pgsql/src/man/Attic/vacuum.l,v 1.7 1998/01/11 22:18:01 momjian Exp $ +.\" $Header: /cvsroot/pgsql/src/man/Attic/vacuum.l,v 1.8 1998/02/03 19:27:30 momjian Exp $ .TH VACUUM SQL 11/05/95 PostgreSQL PostgreSQL .SH NAME vacuum - vacuum a database .SH SYNOPSIS .nf -\fBvacuum [verbose] [analyze] [\fPtable [(column,...)]\fB]\fP +\fBvacuum [verbose] [analyze] [\fPtable\fB]\fP +\fBvacuum [verbose] analyze [\fPtable [(column,...)]\fB]\fP .fi .SH DESCRIPTION .BR Vacuum