mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Remove FAQ mention of DROP column.
This commit is contained in:
21
doc/FAQ
21
doc/FAQ
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Frequently Asked Questions (FAQ) for PostgreSQL
|
Frequently Asked Questions (FAQ) for PostgreSQL
|
||||||
|
|
||||||
Last updated: Mon Jan 31 20:35:58 EST 2005
|
Last updated: Mon Jan 31 20:41:21 EST 2005
|
||||||
|
|
||||||
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
Current maintainer: Bruce Momjian (pgman@candle.pha.pa.us)
|
||||||
|
|
||||||
@ -51,7 +51,7 @@
|
|||||||
4.1) How do I SELECT only the first few rows of a query? A random row?
|
4.1) How do I SELECT only the first few rows of a query? A random row?
|
||||||
4.2) How do I find out what tables, indexes, databases, and users are
|
4.2) How do I find out what tables, indexes, databases, and users are
|
||||||
defined? How do I see the queries used by psql to display them?
|
defined? How do I see the queries used by psql to display them?
|
||||||
4.3) How do you remove a column from a table, or change its data type?
|
4.3) How do you change a column's data type?
|
||||||
4.4) What is the maximum size for a row, a table, and a database?
|
4.4) What is the maximum size for a row, a table, and a database?
|
||||||
4.5) How much database disk space is required to store data from a
|
4.5) How much database disk space is required to store data from a
|
||||||
typical text file?
|
typical text file?
|
||||||
@ -491,25 +491,16 @@
|
|||||||
query to get information about the database.
|
query to get information about the database.
|
||||||
|
|
||||||
There are also system tables beginning with pg_ that describe these
|
There are also system tables beginning with pg_ that describe these
|
||||||
too. Use psql -l will list all databases.
|
too.
|
||||||
|
|
||||||
|
Use psql -l will list all databases.
|
||||||
|
|
||||||
Also try the file pgsql/src/tutorial/syscat.source. It illustrates
|
Also try the file pgsql/src/tutorial/syscat.source. It illustrates
|
||||||
many of the SELECTs needed to get information from the database system
|
many of the SELECTs needed to get information from the database system
|
||||||
tables.
|
tables.
|
||||||
|
|
||||||
4.3) How do you remove a column from a table, or change its data type?
|
4.3) How do you change a column's data type?
|
||||||
|
|
||||||
DROP COLUMN functionality was added in release 7.3 with ALTER TABLE
|
|
||||||
DROP COLUMN. In earlier versions, you can do this:
|
|
||||||
BEGIN;
|
|
||||||
LOCK TABLE old_table;
|
|
||||||
SELECT ... -- select all columns but the one you want to remove
|
|
||||||
INTO TABLE new_table
|
|
||||||
FROM old_table;
|
|
||||||
DROP TABLE old_table;
|
|
||||||
ALTER TABLE new_table RENAME TO old_table;
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
Changing the data type of a column can be done easily in 8.0 and later
|
Changing the data type of a column can be done easily in 8.0 and later
|
||||||
with ALTER TABLE ALTER COLUMN TYPE.
|
with ALTER TABLE ALTER COLUMN TYPE.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
alink="#0000ff">
|
alink="#0000ff">
|
||||||
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
<H1>Frequently Asked Questions (FAQ) for PostgreSQL</H1>
|
||||||
|
|
||||||
<P>Last updated: Mon Jan 31 20:35:58 EST 2005</P>
|
<P>Last updated: Mon Jan 31 20:41:21 EST 2005</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>)
|
"mailto:pgman@candle.pha.pa.us">pgman@candle.pha.pa.us</A>)
|
||||||
@ -74,8 +74,7 @@
|
|||||||
<A href="#4.2">4.2</A>) How do I find out what tables, indexes,
|
<A href="#4.2">4.2</A>) How do I find out what tables, indexes,
|
||||||
databases, and users are defined? How do I see the queries used
|
databases, and users are defined? How do I see the queries used
|
||||||
by <I>psql</I> to display them?<BR>
|
by <I>psql</I> to display them?<BR>
|
||||||
<A href="#4.3">4.3</A>) How do you remove a column from a
|
<A href="#4.3">4.3</A>) How do you change a column's data type?<BR>
|
||||||
table, or change its data type?<BR>
|
|
||||||
<A href="#4.4">4.4</A>) What is the maximum size for a row, a
|
<A href="#4.4">4.4</A>) What is the maximum size for a row, a
|
||||||
table, and a database?<BR>
|
table, and a database?<BR>
|
||||||
<A href="#4.5">4.5</A>) How much database disk space is required
|
<A href="#4.5">4.5</A>) How much database disk space is required
|
||||||
@ -645,28 +644,15 @@
|
|||||||
database.</P>
|
database.</P>
|
||||||
|
|
||||||
<P>There are also system tables beginning with <I>pg_</I> that describe
|
<P>There are also system tables beginning with <I>pg_</I> that describe
|
||||||
these too. Use <I>psql -l</I> will list all databases.</P>
|
these too.</P>
|
||||||
|
|
||||||
|
<P>Use <I>psql -l</I> will list all databases.</P>
|
||||||
|
|
||||||
<P>Also try the file <I>pgsql/src/tutorial/syscat.source</I>. It
|
<P>Also try the file <I>pgsql/src/tutorial/syscat.source</I>. It
|
||||||
illustrates many of the <SMALL>SELECT</SMALL>s needed to get
|
illustrates many of the <SMALL>SELECT</SMALL>s needed to get
|
||||||
information from the database system tables.</P>
|
information from the database system tables.</P>
|
||||||
|
|
||||||
<H4><A name="4.3">4.3</A>) How do you remove a column from a
|
<H4><A name="4.3">4.3</A>) How do you change a column's data type?</H4>
|
||||||
table, or change its data type?</H4>
|
|
||||||
|
|
||||||
<P><SMALL>DROP COLUMN</SMALL> functionality was added in release 7.3
|
|
||||||
with <SMALL>ALTER TABLE DROP COLUMN</SMALL>. In earlier versions,
|
|
||||||
you can do this:</P>
|
|
||||||
<PRE>
|
|
||||||
BEGIN;
|
|
||||||
LOCK TABLE old_table;
|
|
||||||
SELECT ... -- select all columns but the one you want to remove
|
|
||||||
INTO TABLE new_table
|
|
||||||
FROM old_table;
|
|
||||||
DROP TABLE old_table;
|
|
||||||
ALTER TABLE new_table RENAME TO old_table;
|
|
||||||
COMMIT;
|
|
||||||
</PRE>
|
|
||||||
|
|
||||||
<P>Changing the data type of a column can be done easily in 8.0
|
<P>Changing the data type of a column can be done easily in 8.0
|
||||||
and later with <SMALL>ALTER TABLE ALTER COLUMN TYPE</SMALL>.
|
and later with <SMALL>ALTER TABLE ALTER COLUMN TYPE</SMALL>.
|
||||||
|
Reference in New Issue
Block a user