psqlHelp.h 9.31 KB
Newer Older
1 2 3
/*-------------------------------------------------------------------------
 *
 * psqlHelp.h--
4
 *	  Help for query language syntax
5 6 7
 *
 * Copyright (c) 1994, Regents of the University of California
 *
8
 * $Id: psqlHelp.h,v 1.49 1998/07/26 01:18:09 momjian Exp $
9 10 11 12
 *
 *-------------------------------------------------------------------------
 */

13 14
struct _helpStruct
{
15 16 17
	char	   *cmd;			/* the command name */
	char	   *help;			/* the help associated with it */
	char	   *syntax;			/* the syntax associated with it */
18 19
};

20
static struct _helpStruct QL_HELP[] = {
21 22
	{"abort transaction",
		"abort the current transaction",
23 24
    "\
\tabort [transaction|work];"},
25 26
	{"alter table",
		"add/rename attributes, rename tables",
27 28
	"\
\tALTER TABLE class_name [*] ADD COLUMN attr type\n\
29 30
\tALTER TABLE class_name [*] RENAME [COLUMN] attr1 TO attr2\n\
\tALTER TABLE class_name1 RENAME TO class_name2"},
31 32
	{"alter user",
		"alter system information for a user",
33 34
	"\
\tALTER USER user_name\n\
35 36 37 38 39
\t[WITH PASSWORD password]\n\
\t[CREATEDB | NOCCREATEDB]\n\
\t[CREATEUSER | NOCREATEUSER]\n\
\t[IN GROUP group_1, ...groupN]\n\
\t[VALID UNTIL 'abstime'];"},
40 41
	{"begin work",
		"begin a new transaction",
42 43
	"\
\tBEGIN [WORK|TRANSACTION];"},
44 45
	{"cluster",
		"create a clustered index (from an existing index)",
46 47
	"\
\tCLUSTER index_name ON relation_name"},
48 49
	{"close",
		"close an existing cursor (cursor)",
50 51
	"\
\tCLOSE cursorname;"},
52 53
	{"commit work",
		"commit a transaction",
54 55
	"\
\tCOMMIT [WORK|TRANSACTION]"},
56 57
	{"copy",
		"copy data to and from a table",
58 59
	"\
\tCOPY [BINARY] class_name [WITH OIDS]\n\
60
\tTO|FROM filename|STDIN|STDOUT [USING DELIMITERS 'delim'];"},
61
	{"create",
62
		"Please be more specific:",
63 64
	"\
\tcreate aggregate\n\
Bruce Momjian's avatar
Bruce Momjian committed
65 66 67 68 69 70 71 72 73 74
\tcreate database\n\
\tcreate function\n\
\tcreate index\n\
\tcreate operator\n\
\tcreate rule\n\
\tcreate sequence\n\
\tcreate table\n\
\tcreate trigger\n\
\tcreate type\n\
\tcreate view"},
75 76
	{"create aggregate",
		"define an aggregate function",
77 78
	"\
\tCREATE AGGREGATE agg_name [AS] (BASETYPE = data_type, \n\
79 80 81 82
\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]);"},
83 84
	{"create database",
		"create a database",
85 86
	"\
\tCREATE DATABASE dbname [WITH LOCATION = 'dbpath']"},
87 88
	{"create function",
		"create a user-defined function",
89 90
	"\
\tCREATE FUNCTION function_name ([type1, ...typeN]) RETURNS return_type\n\
91 92
\tAS 'object_filename'|'sql-queries'\n\
\tLANGUAGE 'c'|'sql'|'internal';"},
93 94
	{"create index",
		"construct an index",
95 96
	"\
\tCREATE [UNIQUE] INDEX indexname ON class_name [USING access_method]\n\
97
( attr1 [type_class1], ...attrN | funcname(attr1, ...) [type_class] );"},
98 99
	{"create operator",
		"create a user-defined operator",
100 101
	"\
\tCREATE OPERATOR operator_name (\n\
102 103 104 105 106
\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]);"},
107 108
	{"create rule",
		"define a new rule",
109 110
	"\
\tCREATE RULE rule_name AS ON\n\
111 112 113
\t[SELECT|UPDATE|DELETE|INSERT]\n\
\tTO object [WHERE qual]\n\
\tDO [INSTEAD] [action|NOTHING|[actions]];"},
114 115
	{"create sequence",
		"create a new sequence number generator",
116 117
	"\
\tCREATE SEQUENCE sequence_name\n\
118 119 120 121 122 123
\t[INCREMENT number]\n\
\t[START number]\n\
\t[MINVALUE number]\n\
\t[MAXVALUE number]\n\
\t[CACHE number]\n\
\t[CYCLE];"},
124 125
	{"create table",
		"create a new table",
126 127
	"\
\tCREATE TABLE class_name\n\
128 129 130
\t(attr1 type1 [DEFAULT expression] [NOT NULL], ...attrN)\n\
\t[INHERITS (class_name1, ...class_nameN)\n\
\t[[CONSTRAINT name] CHECK condition1, ...conditionN] ]\n\
Bruce Momjian's avatar
Bruce Momjian committed
131
;"},
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
132 133
	{"create trigger",
		"create a new trigger",
134 135
	"\
\tCREATE TRIGGER trigger_name AFTER|BEFORE event1 [OR event2 [OR event3] ]\n\
136 137
\tON class_name FOR EACH ROW|STATEMENT\n\
\tEXECUTE PROCEDURE func_name ([arguments])\n\
Bruce Momjian's avatar
Bruce Momjian committed
138 139
\n\
\teventX is one of INSERT, DELETE, UPDATE"},
140 141
	{"create type",
		"create a new user-defined base data type",
142 143
	"\
\tCREATE TYPE typename (\n\
144 145 146 147 148
\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]);"},
149 150
	{"create user",
		"create a new user",
151 152
	"\
\tCREATE USER user_name\n\
153 154 155 156 157
\t[WITH PASSWORD password]\n\
\t[CREATEDB | NOCREATEDB]\n\
\t[CREATEUSER | NOCREATEUSER]\n\
\t[IN GROUP group1, ...groupN]\n\
\t[VALID UNTIL 'abstime'];"},
158 159
	{"create view",
		"create a view",
160 161
	"\
\tCREATE VIEW view_name AS\n\
162 163 164 165 166
\tSELECT [DISTINCT [ON attrN]]\n\
\texpr1 [AS attr1], ...exprN\n\
\t[FROM from_list]\n\
\t[WHERE qual]\n\
\t[GROUP BY group_list];"},
167 168
	{"declare",
		"set up a cursor",
169 170
	"\
\tDECLARE cursorname [BINARY] CURSOR FOR\n\
171 172 173 174 175 176 177 178
\tSELECT [DISTINCT [ON attrN]]\n\
\texpr1 [AS attr1], ...exprN\n\
\t[FROM from_list]\n\
\t[WHERE qual]\n\
\t[GROUP BY group_list]\n\
\t[HAVING having_clause]\n\
\t[ORDER BY attr1 [USING op1], ...attrN]\n\
\t[UNION [ALL] SELECT ...];"},
179 180
	{"delete",
		"delete tuples",
181 182
	"\
\tDELETE FROM class_name [WHERE qual];"},
183
	{"drop",
184
		"Please be more specific:",
185 186
	"\
\tdrop aggregate\n\
Bruce Momjian's avatar
Bruce Momjian committed
187 188 189 190 191 192 193 194 195 196
\tdrop database\n\
\tdrop function\n\
\tdrop index\n\
\tdrop operator\n\
\tdrop rule\n\
\tdrop sequence\n\
\tdrop table\n\
\tdrop trigger\n\
\tdrop type\n\
\tdrop view"},
197 198
	{"drop aggregate",
		"remove an aggregate function",
199 200
	"\
\tDROP AGGREGATE agg_name agg_type|*;"},
201 202
	{"drop database",
		"remove a database",
203 204
	"\
\tDROP DATABASE dbname"},
205 206
	{"drop function",
		"remove a user-defined function",
207 208
	"\
\tDROP FUNCTION funcname ([type1, ...typeN]);"},
209 210
	{"drop index",
		"remove an existing index",
211 212
	"\
\tDROP INDEX indexname;"},
213 214
	{"drop operator",
		"remove a user-defined operator",
215 216
	"\
\tDROP OPERATOR operator_name ([ltype|NONE],[RTYPE|none]);"},
217 218
	{"drop rule",
		"remove a rule",
219 220
	"\
\tDROP RULE rulename;"},
221 222
	{"drop sequence",
		"remove a sequence number generator",
223 224
	"\
\tDROP SEQUENCE sequence_name[, ...sequence_nameN];"},
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
225 226
	{"drop table",
		"remove a table",
227 228
	"\
\tDROP TABLE class_name1, ...class_nameN;"},
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
229 230
	{"drop trigger",
		"remove a trigger",
231 232
	"\
\tDROP TRIGGER trigger_name ON class_name;"},
233 234
	{"drop type",
		"remove a user-defined base type",
235 236
	"\
\tDROP TYPE typename;"},
237 238
	{"drop user",
		"remove a user from the system",
239 240
	"\
\tDROP USER user_name;"},
241 242
	{"drop view",
		"remove a view",
243 244 245
	"\
\tDROP VIEW view_name"},
	{"end work",
246
		"end the current transaction",
247 248
	"\
\tEND [WORK|TRANSACTION];"},
249 250
	{"explain",
		"explain the query execution plan",
251 252
	"\
\tEXPLAIN [VERBOSE] query"},
253 254
	{"fetch",
		"retrieve tuples from a cursor",
255 256
	"\
\tFETCH [FORWARD|BACKWARD] [number|ALL] [IN cursorname];"},
257 258
	{"grant",
		"grant access control to a user or group",
259 260
	"\
\tGRANT privilege1, ...privilegeN ON rel1, ...relN TO \n\
261 262
[PUBLIC|GROUP group|username]\n\
\t privilege is ALL|SELECT|INSERT|UPDATE|DELETE|RULE"},
263 264
	{"insert",
		"insert tuples",
265 266
	"\
\tINSERT INTO class_name [(attr1, ...attrN)]\n\
267 268 269 270 271 272 273 274
\tVALUES (expr1,..exprN) |\n\
\tSELECT [DISTINCT [ON attrN]]\n\
\texpr1, ...exprN\n\
\t[FROM from_clause]\n\
\t[WHERE qual]\n\
\t[GROUP BY group_list]\n\
\t[HAVING having_clause]\n\
\t[UNION [ALL] SELECT ...];"},
275 276
	{"listen",
		"listen for notification on a relation",
277 278
	"\
\tLISTEN class_name"},
279 280
	{"load",
		"dynamically load a module",
281 282
	"\
\tLOAD 'filename';"},
283 284
	{"lock",
		"exclusive lock a table inside a transaction",
285 286
	"\
\tLOCK [TABLE] class_name;"},
Vadim B. Mikheev's avatar
Vadim B. Mikheev committed
287 288
	{"move",
		"move an cursor position",
289 290
	"\
\tMOVE [FORWARD|BACKWARD] [number|ALL] [IN cursorname];"},
291 292
	{"notify",
		"signal all frontends and backends listening on a relation",
293 294
	"\
\tNOTIFY class_name"},
295 296
	{"reset",
		"set run-time environment back to default",
297
#ifdef MULTIBYTE
298 299
	"\
\tRESET DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"},
300
#else
301 302
	"\
\tRESET DateStyle|GEQO|R_PLANS"},
303
#endif
304 305
	{"revoke",
		"revoke access control from a user or group",
306 307
	"\
\tREVOKE privilege1, ...privilegeN ON rel1, ...relN FROM \n\
308 309
[PUBLIC|GROUP group|username]\n\
\t privilege is ALL|SELECT|INSERT|UPDATE|DELETE|RULE"},
310
	{"rollback work",
311
		"abort a transaction",
312 313
	"\
\tROLLBACK [WORK|TRANSACTION]"},
314 315
	{"select",
		"retrieve tuples",
316 317
	"\
\tSELECT [DISTINCT [ON attrN]] expr1 [AS attr1], ...exprN\n\
318 319 320 321 322 323 324
\t[INTO [TABLE] class_name]\n\
\t[FROM from_list]\n\
\t[WHERE qual]\n\
\t[GROUP BY group_list]\n\
\t[HAVING having_clause]\n\
\t[ORDER BY attr1 [ASC|DESC] [USING op1], ...attrN ]\n\
\t[UNION [ALL] SELECT ...];"},
325 326
	{"set",
		"set run-time environment",
327
#ifdef MULTIBYTE
328 329
	"\
\tSET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'\n\
330 331 332
set GEQO TO 'ON[=#]'|'OFF'\n\
set R_PLANS TO 'ON'|'OFF'\n\
set CLIENT_ENCODING TO 'EUC_JP'|'SJIS'|'EUC_CN'|'EUC_KR'|'EUC_TW'|'MULE_INTERNAL'|'LATIN1'|'LATIN2'|'LATIN3'|'LATIN4'|'LATIN5'"},
333
#else
334 335
	"\
\tSET DateStyle TO 'ISO'|'SQL'|'Postgres'|'European'|'US'|'NonEuropean'\n\
336 337
set GEQO TO 'ON[=#]'|'OFF'\n\
set R_PLANS TO 'ON'| 'OFF'"},
338
#endif
339 340
	{"show",
		"show current run-time environment",
341
#ifdef MULTIBYTE
342 343
	"\
\tSHOW DateStyle|GEQO|R_PLANS|CLIENT_ENCODING"},
344
#else
345 346
	"\
\tSHOW DateStyle|GEQO|R_PLANS"},
347
#endif
348
	{"UPDATE",
349
		"update tuples",
350 351
	"\
\tUPDATE class_name SET attr1 = expr1, ...attrN = exprN\n\
352 353
\t [FROM from_clause]\n\
\t[WHERE qual];"},
354 355
	{"vacuum",
		"vacuum the database, i.e. cleans out deleted records, updates statistics",
356 357
	"\
\tVACUUM [VERBOSE] [ANALYZE] [table]\n\
Bruce Momjian's avatar
Bruce Momjian committed
358
\tor\n\
359
\tVACUUM [VERBOSE]  ANALYZE  [table [(attr1, ...attrN)]];"},
360 361
	{NULL, NULL, NULL}			/* important to keep a NULL terminator
								 * here! */
362
};