psqlHelp.h 8.36 KB
Newer Older
1 2 3 4 5 6 7
/*-------------------------------------------------------------------------
 *
 * psqlHelp.h--
 *    Help for query language syntax
 *
 * Copyright (c) 1994, Regents of the University of California
 *
8
 * $Id: psqlHelp.h,v 1.16 1997/06/01 04:53:44 momjian Exp $
9 10 11 12 13
 *
 *-------------------------------------------------------------------------
 */

struct _helpStruct {
14 15 16
  char *cmd; /* the command name */
  char *help; /* the help associated with it */
  char *syntax; /* the syntax associated with it */
17 18 19 20 21 22 23 24 25 26 27
} ;
 
static struct _helpStruct QL_HELP[] = {
  { "abort",
      "abort the current transaction",
      "abort [transaction];"},
  { "abort transaction",
      "abort the current transaction",
      "abort [transaction];"},
  { "alter table",
      "add/rename attributes, rename tables",
28
      "\talter table <class_name> [*] add column <attr> <type>;\n\talter table <class_name> [*] rename [column] <attr1> to <attr2>;\n\talter table <class_name1> rename to <class_name2>"},
29 30 31 32 33 34 35 36 37 38 39 40 41
  { "begin",
      "begin a new transaction",
      "begin [transaction|work];"},
  { "begin transaction",
      "begin a new transaction",
      "begin [transaction|work];"},
  { "begin work",
      "begin a new transaction",
      "begin [transaction|work];"},
  { "cluster",
      "create a clustered index (from an existing index)",
      "cluster <index_name> on <relation_name>"},
  { "close",
42 43
      "close an existing cursor (cursor)",
      "close <cursorname>;"},
44 45 46 47 48 49 50 51
  { "commit",
      "commit a transaction",
      "commit [work]"},
  { "commit work",
      "commit a transaction",
      "commit [work]"},
  { "copy",
      "copy data to and from a table",
52
      "copy [binary] <class_name> [with oids]\n\t{to|from} {<filename>|stdin|stdout} [using delimiters <delim>];"},
53 54
  { "create",   
      "Please more be specific:",
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
55
      "\tcreate aggregate\n\tcreate database\n\tcreate function\n\tcreate index\n\tcreate operator\n\tcreate rule\n\tcreate sequence\n\tcreate table\n\tcreate type\n\tcreate view"},
56 57 58 59 60 61 62 63 64 65 66
  { "create aggregate",
      "define an aggregate function",
      "create aggregate <agg_name> [as] (basetype = <data_type>, \n\t[sfunc1 = <sfunc_1>, stype1 = <sfunc1_return_type>]\n\t[sfunc2 = <sfunc_2>, stype2 = <sfunc2_return_type>]\n\t[,finalfunc = <final-function>]\n\t[,initcond1 = <initial-cond1>][,initcond2 = <initial-cond2>]);"},
  { "create database", 
    "create a database",
    "create database <dbname>"},
  { "create function",
      "create a user-defined function",
      "create function <function_name> ([<type1>,...<typeN>]) returns <return_type>\n\tas '<object_filename>'|'<sql-queries>'\n\tlanguage 'c'|'sql'|'internal';"},
  { "create index",
      "construct an index",
67
      "create [unique] index <indexname> on <class_name> [using <access_method>]\n( <attr1> [<type_class1>] [,...] | <funcname>(<attr1>,...) [<type_class>] );"},
68 69 70 71 72 73
  { "create operator",
      "create a user-defined operator",
      "create operator <operator_name> (\n\t[leftarg = <type1>][,rightarg = <type2>]\n\t,procedure = <func_name>,\n\t[,commutator = <com_op>][,negator = <neg_op>]\n\t[,restrict = <res_proc>][,hashes]\n\t[,join = <join_proc>][,sort = <sort_op1>...<sort_opN>]);"},
  { "create rule",
      "define a new rule",
      "create rule <rule_name> as on\n\t[select|update|delete|insert]\n\tto <object> [where <qual>]\n\tdo [instead] [<action>|nothing| [<actions>]];"},
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
74 75 76
  { "create sequence",
      "create a new sequence number generator",
      "create sequence <sequence_name>\n\t[increment <NUMBER>]\n\t[start <NUMBER>]\n\t[minvalue <NUMBER>]\n\t[maxvalue <NUMBER>]\n\t[cache <NUMBER>]\n\t[cycle];"},
77 78
  { "create table",
      "create a new table",
79
      "create table <class_name> ( <attr1> <type1>,... <attrN> <typeN>)\n\t[inherits (<class_name1>,...<class_nameN>\n\tarchive=<archive_mode>\n\tstore=<smgr_name>\n\tarch_store=<smgr_name>];"},
80 81 82 83 84 85 86
  { "create type",
      "create a new user-defined base data type",
      "create type <typename> (\n\tinternallength = (<number> | variable),\n\t[externallength = (<number>|variable),]\n\tinput=<input_function>, output = <output_function>\n\t[,element = <typename>][,delimiter=<character>][,default=\'<string>\']\n\t[,send = <send_function>][,receive = <receive_function>][,passedbyvalue]);"},
  { "create view",
      "create a view",
      "create view <view_name> as select <expr1>[as <attr1>][,... <exprN>[as <attrN>]] [from <from_list>] [where <qual>];"},
  { "declare",
87 88
      "set up a cursor",
      "declare <cursorname> [binary] cursor for\n\tselect [distinct]\n\t<expr1> [as <attr1>],...<exprN> [as <attrN>]\n\t[from <from_list>] [where <qual>]\n\t[order by <attr1> [using <op1>],... <attrN> [using <opN>]];"},
89 90
  { "delete",
      "delete tuples",
91
      "delete from <class_name> [where <qual>];"},
92 93
  { "drop",   
      "Please more be specific:",
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
94
      "\tdrop aggregate\n\tdrop database\n\tdrop function\n\tdrop index\n\tdrop operator\n\tdrop rule\n\tdrop sequence\n\tdrop table\n\tdrop type\n\tdrop view"},
95 96
  { "drop aggregate",
      "remove an aggregate function",
97
      "drop aggregate <agg_name> <agg_type>|*;"},
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
  { "drop database",
     "remove a database",
     "drop database <dbname>"},
  { "drop function",
      "remove a user-defined function",
      "drop function <funcname> ([<type1>,....<typeN>]);"},
  { "drop index", 
      "remove an existing index",
      "drop index <indexname>;"},
  { "drop operator",
      "remove a user-defined operator",
      "drop operator <operator_name> ([<ltype>|none],[<rtype>|none]);"},
  { "drop rule",
      "remove a rule",
      "drop rule <rulename>;"},
  { "drop table", 
      "remove a table", 
115
      "drop table <class_name>[,...<class_nameN];"},
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
116 117 118
  { "drop sequence", 
      "remove a sequence number generator", 
      "drop sequence <sequence_name>[,...<sequence_nameN];"},
119 120 121 122 123 124 125 126 127 128 129 130 131 132
  { "drop type",
      "remove a user-defined base type",
      "drop type <typename>;"},
  { "drop view",
      "remove a view",
      "drop view <view_name>"},
  { "end",
      "end the current transaction",
      "end [transaction];"},
  { "end transaction",
      "end the current transaction",
      "end [transaction];"},
  { "explain",
      "explain the query execution plan",
Bruce Momjian's avatar
Bruce Momjian committed
133
      "explain [with {cost|plan|full}] <query>"},
134
  { "fetch",
135 136
      "retrieve tuples from a cursor",
      "fetch [forward|backward] [<number>|all] [in <cursorname>];"},
137 138 139 140 141
  { "grant",
      "grant access control to a user or group",
      "grant <privilege[,privilege,...]> on <rel1>[,...<reln>] to \n[public | group <group> | <username>]\n\t privilege is {ALL | SELECT | INSERT | UPDATE | DELETE | RULE}"},
  { "insert",
      "insert tuples",
142
      "insert into <class_name> [(<attr1>...<attrN>)]\n\t[values (<expr1>...<exprN>); |\n\tselect <expr1>,...<exprN> [from <from_clause>] [where <qual>];"},
143 144
  { "listen",
       "listen for notification on a relation",
145
       "listen <class_name>"},
146 147 148 149 150
  { "load",
      "dynamically load a module",
      "load <filename>;"},
  { "notify",
      "signal all frontends and backends listening on a relation",
151
      "notify <class_name>"},
152 153
  { "purge",
      "purge historical data",
154
      "purge <class_name> [before <abstime>] [after <reltime>];"},
155 156 157
  { "reset",
      "set run-time environment back to default",
      "reset {DateStyle | GEQO}"},
158 159 160 161 162
  { "revoke",
      "revoke access control from a user or group",
      "revoke <privilege[,privilege,...]> on <rel1>[,...<reln>] from \n[public | group <group> | <username>]\n\t privilege is {ALL | SELECT | INSERT | UPDATE | DELETE | RULE}"},
  { "rollback",
      "abort a transaction",
163
      "rollback [transaction|work]"},
164 165
  { "select",
      "retrieve tuples",
166
      "select [distinct on <attr>] <expr1> [as <attr1>], ... <exprN> [as <attrN>]\n\t[into table <class_name>] [from <from_list>]\n\t[where <qual>]\n\t[order by <attr1>\n\t\t[using <op1>],..<attrN> [[using <opN>] | ASC | DESC]];" },
167 168
  { "set",
      "set run-time environment",
169
      "set DateStyle {ISO | SQL | Postgres | European | US | NonEuropean}\nset GEQO = {ON | OFF}\nset R_PLANS {ON | OFF}"},
170 171 172
  { "show",
      "show current run-time environment",
      "show {DateStyle | GEQO}"},
173 174
  { "update",
      "update tuples",
175
      "update <class_name> set <attr1>=<expr1>,...<attrN>=<exprN> [from <from_clause>] [where <qual>];"},
176 177
  { "vacuum",
      "vacuum the database, i.e. cleans out deleted records, updates statistics",
178
      "vacuum [verbose] [analyze]\n\tor\nvacuum [verbose] [analyze] table [analyze [(attr1, ... attrN)] ];"},
179 180
  { NULL, NULL, NULL}  /* important to keep a NULL terminator here! */
};