|
1 | 1 | <!-- |
2 | | -$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.86 2006/07/02 02:23:17 momjian Exp $ |
| 2 | +$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.87 2006/07/04 18:07:24 tgl Exp $ |
3 | 3 | PostgreSQL documentation |
4 | 4 | --> |
5 | 5 |
|
@@ -46,8 +46,8 @@ where <replaceable class="PARAMETER">action</replaceable> is one of: |
46 | 46 | CLUSTER ON <replaceable class="PARAMETER">index_name</replaceable> |
47 | 47 | SET WITHOUT CLUSTER |
48 | 48 | SET WITHOUT OIDS |
49 | | - SET (FILLFACTOR =<replaceable class="PARAMETER">fillfactor</replaceable>) |
50 | | - RESET (FILLFACTOR) |
| 49 | + SET ( <replaceable class="PARAMETER">storage_parameter</replaceable> =<replaceable class="PARAMETER">value</replaceable> [, ... ]) |
| 50 | + RESET ( <replaceable class="PARAMETER">storage_parameter</replaceable> [, ... ]) |
51 | 51 | INHERIT <replaceable class="PARAMETER">parent_table</replaceable> |
52 | 52 | NO INHERIT <replaceable class="PARAMETER">parent_table</replaceable> |
53 | 53 | OWNER TO <replaceable class="PARAMETER">new_owner</replaceable> |
@@ -254,47 +254,79 @@ where <replaceable class="PARAMETER">action</replaceable> is one of: |
254 | 254 | </varlistentry> |
255 | 255 |
|
256 | 256 | <varlistentry> |
257 | | - <term><literal>INHERIT<replaceable class="PARAMETER">parent_table</replaceable></literal></term> |
| 257 | + <term><literal>SET (<replaceable class="PARAMETER">storage_parameter</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] )</literal></term> |
258 | 258 | <listitem> |
259 | 259 | <para> |
| 260 | + This form changes one or more storage parameters for the table. See |
| 261 | + <xref linkend="SQL-CREATETABLE" endterm="sql-createtable-title"> |
| 262 | + for details on the available parameters. Note that the table contents |
| 263 | + will not be modified immediately by this command; depending on the |
| 264 | + parameter you may need to rewrite the table to get the desired effects. |
| 265 | + That can be done with <xref linkend="SQL-CLUSTER" |
| 266 | + endterm="sql-cluster-title"> or one of the forms of <command>ALTER |
| 267 | + TABLE</> that forces a table rewrite. |
| 268 | + </para> |
| 269 | + |
| 270 | + <note> |
| 271 | + <para> |
| 272 | + While <command>CREATE TABLE</> allows <literal>OIDS</> to be specified |
| 273 | + in the <literal>WITH (<replaceable |
| 274 | + class="PARAMETER">storage_parameter</>)</literal> syntax, |
| 275 | + <command>ALTER TABLE</> does not treat <literal>OIDS</> as a |
| 276 | + storage parameter. |
| 277 | + </para> |
| 278 | + </note> |
| 279 | + </listitem> |
| 280 | + </varlistentry> |
260 | 281 |
|
| 282 | + <varlistentry> |
| 283 | + <term><literal>RESET ( <replaceable class="PARAMETER">storage_parameter</replaceable> [, ... ] )</literal></term> |
| 284 | + <listitem> |
| 285 | + <para> |
| 286 | + This form resets one or more storage parameters to their |
| 287 | + defaults. As with <literal>SET</>, a table rewrite may be |
| 288 | + needed to update the table entirely. |
| 289 | + </para> |
| 290 | + </listitem> |
| 291 | + </varlistentry> |
| 292 | + |
| 293 | + <varlistentry> |
| 294 | + <term><literal>INHERIT <replaceable class="PARAMETER">parent_table</replaceable></literal></term> |
| 295 | + <listitem> |
| 296 | + <para> |
261 | 297 | This form adds a new parent table to the table. This won't add new |
262 | 298 | columns to the child table, instead all columns of the parent table must |
263 | 299 | already exist in the child table. They must have matching data types, |
264 | 300 | and if they have <literal>NOT NULL</literal> constraints in the parent |
265 | 301 | then they must also have <literal>NOT NULL</literal> constraints in the |
266 | 302 | child. |
| 303 | + </para> |
267 | 304 |
|
268 | | - </para> |
269 | | - <para> |
270 | | - |
| 305 | + <para> |
271 | 306 | There must also be matching table constraints for all |
272 | 307 | <literal>CHECK</literal> table constraints of the parent. Currently |
273 | 308 | <literal>UNIQUE</literal>, <literal>PRIMARY KEY</literal>, and |
274 | 309 | <literal>FOREIGN KEY</literal> constraints are ignored however this may |
275 | 310 | change in the future. |
| 311 | + </para> |
276 | 312 |
|
277 | | - </para> |
278 | | - <para> |
279 | | - |
| 313 | + <para> |
280 | 314 | The easiest way to create a suitable table is to create a table using |
281 | 315 | <literal>INHERITS</literal> and then remove it via <literal>NO |
282 | 316 | INHERIT</literal>. Alternatively create a table using |
283 | 317 | <literal>LIKE</literal> however note that <literal>LIKE</literal> does |
284 | 318 | not create the necessary constraints. |
285 | | - |
286 | 319 | </para> |
287 | | - |
288 | 320 | </listitem> |
289 | 321 | </varlistentry> |
290 | 322 |
|
291 | 323 | <varlistentry> |
292 | 324 | <term><literal>NO INHERIT <replaceable class="PARAMETER">parent_table</replaceable></literal></term> |
293 | 325 | <listitem> |
294 | 326 | <para> |
295 | | - This form removes a parent table from the list of parents of the table. |
296 | | - Queries against the parent table will no longer include records drawn |
297 | | - from the target table. |
| 327 | + This form removes a parent table from the list of parents of the table. |
| 328 | + Queries against the parent table will no longer include records drawn |
| 329 | + from the target table. |
298 | 330 | </para> |
299 | 331 | </listitem> |
300 | 332 | </varlistentry> |
@@ -323,26 +355,6 @@ where <replaceable class="PARAMETER">action</replaceable> is one of: |
323 | 355 | </listitem> |
324 | 356 | </varlistentry> |
325 | 357 |
|
326 | | - <varlistentry> |
327 | | - <term><literal>SET (FILLFACTOR)</literal></term> |
328 | | - <listitem> |
329 | | - <para> |
330 | | - This form changes the table's fillfactor to the specified percentage. |
331 | | - Table structure is not modified immediately; use <literal>CLUSTER</literal> |
332 | | - to ensure reflection of the change. |
333 | | - </para> |
334 | | - </listitem> |
335 | | - </varlistentry> |
336 | | - |
337 | | - <varlistentry> |
338 | | - <term><literal>RESET</literal></term> |
339 | | - <listitem> |
340 | | - <para> |
341 | | - This form changes the table's fillfactor to the default value. |
342 | | - </para> |
343 | | - </listitem> |
344 | | - </varlistentry> |
345 | | - |
346 | 358 | <varlistentry> |
347 | 359 | <term><literal>RENAME</literal></term> |
348 | 360 | <listitem> |
@@ -524,6 +536,34 @@ where <replaceable class="PARAMETER">action</replaceable> is one of: |
524 | 536 | </listitem> |
525 | 537 | </varlistentry> |
526 | 538 |
|
| 539 | + <varlistentry> |
| 540 | + <term><replaceable class="PARAMETER">storage_parameter</replaceable></term> |
| 541 | + <listitem> |
| 542 | + <para> |
| 543 | + The name of a table storage parameter. |
| 544 | + </para> |
| 545 | + </listitem> |
| 546 | + </varlistentry> |
| 547 | + |
| 548 | + <varlistentry> |
| 549 | + <term><replaceable class="PARAMETER">value</replaceable></term> |
| 550 | + <listitem> |
| 551 | + <para> |
| 552 | + The new value for a table storage parameter. |
| 553 | + This might be a number or a word depending on the parameter. |
| 554 | + </para> |
| 555 | + </listitem> |
| 556 | + </varlistentry> |
| 557 | + |
| 558 | + <varlistentry> |
| 559 | + <term><replaceable class="PARAMETER">parent_table</replaceable></term> |
| 560 | + <listitem> |
| 561 | + <para> |
| 562 | + A parent table to associate or de-associate with this table. |
| 563 | + </para> |
| 564 | + </listitem> |
| 565 | + </varlistentry> |
| 566 | + |
527 | 567 | <varlistentry> |
528 | 568 | <term><replaceable class="PARAMETER">new_owner</replaceable></term> |
529 | 569 | <listitem> |
|