Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaafe72e

Browse files
committed
Update DROP COLUMN example to use transactions and rollback-able DROP TABLE>
1 parent97b6e3f commitaafe72e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

‎doc/FAQ

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Frequently Asked Questions (FAQ) for PostgreSQL
33

4-
Last updated:Thu Apr18 00:44:51 EDT 2002
4+
Last updated:Fri Apr26 23:03:46 EDT 2002
55

66
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
77

@@ -637,11 +637,14 @@
637637
4.4) How do you remove a column from a table?
638638

639639
We do not support ALTER TABLE DROP COLUMN, but do this:
640+
BEGIN;
641+
LOCK TABLE old_table;
640642
SELECT ... -- select all columns but the one you want to remove
641643
INTO TABLE new_table
642644
FROM old_table;
643645
DROP TABLE old_table;
644646
ALTER TABLE new_table RENAME TO old_table;
647+
COMMIT;
645648

646649
4.5) What is the maximum size for a row, a table, and a database?
647650

‎doc/src/FAQ/FAQ.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
alink="#0000ff">
1515
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
1616

17-
<P>Last updated:Thu Apr18 00:44:51 EDT 2002</P>
17+
<P>Last updated:Fri Apr26 23:03:46 EDT 2002</P>
1818

1919
<P>Current maintainer: Bruce Momjian (<Ahref=
2020
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)<BR>
@@ -827,11 +827,14 @@ <H4><A name="4.4">4.4</A>) How do you remove a column from a
827827
<P>We do not support<SMALL>ALTER TABLE DROP COLUMN,</SMALL> but do
828828
this:</P>
829829
<PRE>
830+
BEGIN;
831+
LOCK TABLE old_table;
830832
SELECT ... -- select all columns but the one you want to remove
831833
INTO TABLE new_table
832834
FROM old_table;
833835
DROP TABLE old_table;
834836
ALTER TABLE new_table RENAME TO old_table;
837+
COMMIT;
835838
</PRE>
836839

837840
<H4><Aname="4.5">4.5</A>) What is the maximum size for a row, a

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp