Update DROP COLUMN example to use transactions and rollback-able DROP TABLE>
This commit is contained in:
parent
97b6e3f06f
commit
aafe72efb2
5
doc/FAQ
5
doc/FAQ
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Frequently Asked Questions (FAQ) for PostgreSQL
|
Frequently Asked Questions (FAQ) for PostgreSQL
|
||||||
|
|
||||||
Last updated: Thu Apr 18 00:44:51 EDT 2002
|
Last updated: Fri Apr 26 23:03:46 EDT 2002
|
||||||
|
|
||||||
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
||||||
|
|
||||||
@ -637,11 +637,14 @@
|
|||||||
4.4) How do you remove a column from a table?
|
4.4) How do you remove a column from a table?
|
||||||
|
|
||||||
We do not support ALTER TABLE DROP COLUMN, but do this:
|
We do not support ALTER TABLE DROP COLUMN, but do this:
|
||||||
|
BEGIN;
|
||||||
|
LOCK TABLE old_table;
|
||||||
SELECT ... -- select all columns but the one you want to remove
|
SELECT ... -- select all columns but the one you want to remove
|
||||||
INTO TABLE new_table
|
INTO TABLE new_table
|
||||||
FROM old_table;
|
FROM old_table;
|
||||||
DROP TABLE old_table;
|
DROP TABLE old_table;
|
||||||
ALTER TABLE new_table RENAME TO old_table;
|
ALTER TABLE new_table RENAME TO old_table;
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
4.5) What is the maximum size for a row, a table, and a database?
|
4.5) What is the maximum size for a row, a table, and a database?
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
alink="#0000ff">
|
alink="#0000ff">
|
||||||
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
||||||
|
|
||||||
<P>Last updated: Thu Apr 18 00:44:51 EDT 2002</P>
|
<P>Last updated: Fri Apr 26 23:03:46 EDT 2002</P>
|
||||||
|
|
||||||
<P>Current maintainer: Bruce Momjian (<A href=
|
<P>Current maintainer: Bruce Momjian (<A href=
|
||||||
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
|
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
|
||||||
@ -827,11 +827,14 @@
|
|||||||
<P>We do not support <SMALL>ALTER TABLE DROP COLUMN,</SMALL> but do
|
<P>We do not support <SMALL>ALTER TABLE DROP COLUMN,</SMALL> but do
|
||||||
this:</P>
|
this:</P>
|
||||||
<PRE>
|
<PRE>
|
||||||
|
BEGIN;
|
||||||
|
LOCK TABLE old_table;
|
||||||
SELECT ... -- select all columns but the one you want to remove
|
SELECT ... -- select all columns but the one you want to remove
|
||||||
INTO TABLE new_table
|
INTO TABLE new_table
|
||||||
FROM old_table;
|
FROM old_table;
|
||||||
DROP TABLE old_table;
|
DROP TABLE old_table;
|
||||||
ALTER TABLE new_table RENAME TO old_table;
|
ALTER TABLE new_table RENAME TO old_table;
|
||||||
|
COMMIT;
|
||||||
</PRE>
|
</PRE>
|
||||||
|
|
||||||
<H4><A name="4.5">4.5</A>) What is the maximum size for a row, a
|
<H4><A name="4.5">4.5</A>) What is the maximum size for a row, a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user