pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedAlter table
22+ messages / 13 participants
[nested] [flat]
* Alter table
@ 2002-11-08 07:22 Rachel.Vaudron <rachel@lazaret.unice.fr>
0 siblings, 2 replies; 22+ messages in thread
From: Rachel.Vaudron @ 2002-11-08 07:22 UTC (permalink / raw)
To: pgsql-sql
Hi,
I wonder if it is possible to remove a field of a table ?
I haven't found anything about this into the reference manual.
Can I do something like that ?:
ALTER TABLE table
DROP COLUMN column;
Thanks
Rachel
**************************************
Rachel.Vaudron@lazaret.unice.fr
Laboratoire de prehistoire du Lazaret
33 bis bd Franck Pilatte 06300 Nice
http://rachel.familinux.org
******** Windows a bug's life ********
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: Alter table
@ 2002-11-08 08:44 Tomasz Myrta <jasiek@klaster.net>
parent: Rachel.Vaudron <rachel@lazaret.unice.fr>
1 sibling, 1 reply; 22+ messages in thread
From: Tomasz Myrta @ 2002-11-08 08:44 UTC (permalink / raw)
To: Rachel.Vaudron <rachel@lazaret.unice.fr>; +Cc: pgsql-sql
Uz.ytkownik Rachel.Vaudron napisa?:
> Hi,
>
> I wonder if it is possible to remove a field of a table ?
> I haven't found anything about this into the reference manual.
> Can I do something like that ?:
>
> ALTER TABLE table
> DROP COLUMN column;
alter table xxx rename to temp;
create table xxx as
select field1, field2, ...without some field... from temp;
drop table temp;
Tomasz Myrta
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: Alter table
@ 2002-11-08 08:50 Rachel.Vaudron <rachel@lazaret.unice.fr>
parent: Tomasz Myrta <jasiek@klaster.net>
0 siblings, 0 replies; 22+ messages in thread
From: Rachel.Vaudron @ 2002-11-08 08:50 UTC (permalink / raw)
To: Tomasz Myrta <jasiek@klaster.net>; +Cc: pgsql-sql
Thanks a lot, but it's already what i am doing!
It's very a pity that there is no way do to this more quickly!!!
> alter table xxx rename to temp;
> create table xxx as
> select field1, field2, ...without some field... from temp;
> drop table temp;
>
> Tomasz Myrta
>
>
Rachel
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: Alter table
@ 2002-11-08 13:24 Daniel Schuchardt <daniel_schuchardt@web.de>
parent: Rachel.Vaudron <rachel@lazaret.unice.fr>
1 sibling, 0 replies; 22+ messages in thread
From: Daniel Schuchardt @ 2002-11-08 13:24 UTC (permalink / raw)
To: pgsql-sql
I think 7.3 has this feature.
Daniel
""Rachel.Vaudron"" <rachel@lazaret.unice.fr> schrieb im Newsbeitrag
news:Pine.LNX.4.33.0211080811160.12232-100000@lazaret.unice.fr...
> Hi,
>
> I wonder if it is possible to remove a field of a table ?
> I haven't found anything about this into the reference manual.
> Can I do something like that ?:
>
> ALTER TABLE table
> DROP COLUMN column;
>
> Thanks
> Rachel
> **************************************
> Rachel.Vaudron@lazaret.unice.fr
> Laboratoire de prehistoire du Lazaret
> 33 bis bd Franck Pilatte 06300 Nice
> http://rachel.familinux.org
> ******** Windows a bug's life ********
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
^ permalink raw reply [nested|flat] 22+ messages in thread
* Alter table
@ 2004-03-10 16:58 David <de4@kent.ac.uk>
0 siblings, 1 reply; 22+ messages in thread
From: David @ 2004-03-10 16:58 UTC (permalink / raw)
To: pgsql-sql
Ok another very newbie question. How can i change the data type a column can
accept? at the moment it will only take character(7) i want to change it to
varchar(30), but i cant figure how, ideas?
Many thanks Dave
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: Alter table
@ 2004-03-10 17:55 scott.marlowe <scott.marlowe@ihs.com>
parent: David <de4@kent.ac.uk>
0 siblings, 0 replies; 22+ messages in thread
From: scott.marlowe @ 2004-03-10 17:55 UTC (permalink / raw)
To: David <de4@kent.ac.uk>; +Cc: pgsql-sql
On Wed, 10 Mar 2004, David wrote:
> Ok another very newbie question. How can i change the data type a column can
> accept? at the moment it will only take character(7) i want to change it to
> varchar(30), but i cant figure how, ideas?
While there are ways to tinker with the system catalogs to change between
different text types / lengths, none of these are "officially supported"
and may well screw up your database if you do something wrong. I believe
the archives likely have this question over and over in them.
The proper way to do this is to make a new column, put the old column in
it, and then drop the old column:
create table test (a char(7));
insert a few thousand lines to test...;
begin;
alter table test add column b varchar(30);
update test set b=a;
alter table test drop column a;
commit; (or rollback; should things go horribly wrong...)
vacuum full test;
^ permalink raw reply [nested|flat] 22+ messages in thread
* alter table
@ 2006-02-15 18:11 Maciej Piekielniak <piechcio@isb.com.pl>
0 siblings, 2 replies; 22+ messages in thread
From: Maciej Piekielniak @ 2006-02-15 18:11 UTC (permalink / raw)
To: pgsql-sql
Hello ,
How can i modify few fields with alter?
ALTER TABLE fv_wystawione
ALTER id_fv SET DEFAULT nextval('id_fv_seq'::text),
ALTER imie SET DEFAULT '';
Syntax error in last line.
--
Best regards,
Maciej mailto:piechcio@isb.com.pl
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 18:54 Andreas Kretschmer <akretschmer@spamfence.net>
parent: Maciej Piekielniak <piechcio@isb.com.pl>
1 sibling, 1 reply; 22+ messages in thread
From: Andreas Kretschmer @ 2006-02-15 18:54 UTC (permalink / raw)
To: pgsql-sql
Maciej Piekielniak <piechcio@isb.com.pl> schrieb:
> Hello ,
>
> How can i modify few fields with alter?
>
> ALTER TABLE fv_wystawione
> ALTER id_fv SET DEFAULT nextval('id_fv_seq'::text),
> ALTER imie SET DEFAULT '';
test=# create table xyz (id int not null);
CREATE TABLE
test=# create sequence xyz_seq;
CREATE SEQUENCE
test=# alter table xyz alter column id set default nextval('xyz_seq');
ALTER TABLE
or:
test=# drop TABLE xyz;
DROP TABLE
test=# create table xyz (id int not null, foo varchar);
CREATE TABLE
test=# alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default '';
ALTER TABLE
HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 19:23 Maciej Piekielniak <piechcio@isb.com.pl>
parent: Andreas Kretschmer <akretschmer@spamfence.net>
0 siblings, 1 reply; 22+ messages in thread
From: Maciej Piekielniak @ 2006-02-15 19:23 UTC (permalink / raw)
To: Andreas Kretschmer <akretschmer@spamfence.net>; +Cc: pgsql-sql
Hello Andreas,
Wednesday, February 15, 2006, 7:54:28 PM, you wrote:
AK> test=# alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default '';
PGAdmin-SQL:
alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default '';
ERROR: syntax error at or near "," at character 63
--
Best regards,
Maciej mailto:piechcio@isb.com.pl
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 19:27 Andreas Kretschmer <akretschmer@spamfence.net>
parent: Maciej Piekielniak <piechcio@isb.com.pl>
0 siblings, 1 reply; 22+ messages in thread
From: Andreas Kretschmer @ 2006-02-15 19:27 UTC (permalink / raw)
To: pgsql-sql
Maciej Piekielniak <piechcio@isb.com.pl> schrieb:
> Hello Andreas,
>
> Wednesday, February 15, 2006, 7:54:28 PM, you wrote:
> AK> test=# alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default '';
>
> PGAdmin-SQL:
>
> alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default '';
>
> ERROR: syntax error at or near "," at character 63
Hmm.
test=# select version();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 8.1.2 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.0.3 20060104 (prerelease) (Debian 4.0.2-6)
(1 row)
i'm working with the native client - psql.
HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 19:30 Maciej Piekielniak <piechcio@isb.com.pl>
parent: Andreas Kretschmer <akretschmer@spamfence.net>
0 siblings, 0 replies; 22+ messages in thread
From: Maciej Piekielniak @ 2006-02-15 19:30 UTC (permalink / raw)
To: Andreas Kretschmer <akretschmer@spamfence.net>; +Cc: pgsql-sql
Hello Andreas,
Wednesday, February 15, 2006, 8:27:00 PM, you wrote:
AK> test=# select version();
AK> version
AK> --------------------------------------------------------------------------------------------------------------
AK> PostgreSQL 8.1.2 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.0.3 20060104 (prerelease) (Debian 4.0.2-6)
AK> (1 row)
AK> i'm working with the native client - psql.
AK> HTH, Andreas
"PostgreSQL 7.4.7 on i386-pc-linux-gnu, compiled by GCC i386-linux-gcc (GCC) 3.3.5 (Debian 1:3.3.5-12)"
I must work on 7.4...
--
Best regards,
Maciej mailto:piechcio@isb.com.pl
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 19:31 Owen Jacobson <ojacobson@osl.com>
0 siblings, 0 replies; 22+ messages in thread
From: Owen Jacobson @ 2006-02-15 19:31 UTC (permalink / raw)
To: pgsql-sql
Andreas Kretschmer wrote:
>
> Maciej Piekielniak <piechcio@isb.com.pl> schrieb:
>
> > Hello Andreas,
> >
> > Wednesday, February 15, 2006, 7:54:28 PM, you wrote:
> > AK> test=# alter table xyz alter column id set default
> nextval('xyz_seq'), alter column foo set default '';
> >
> > PGAdmin-SQL:
> >
> > alter table xyz alter column id set default
> nextval('xyz_seq'), alter column foo set default '';
> >
> > ERROR: syntax error at or near "," at character 63
>
> Hmm.
>
> test=# select version();
> version
> --------------------------------------------------------------
> ------------------------------------------------
> PostgreSQL 8.1.2 on i486-pc-linux-gnu, compiled by GCC cc
> (GCC) 4.0.3 20060104 (prerelease) (Debian 4.0.2-6)
> (1 row)
Note that prior to 8.0 PostgreSQL does not support multiple ALTER actions in a single query. To get an equivalent effect, wrap separate ALTER TABLE queries in a transaction:
BEGIN;
alter table xyz alter column id set default nextval('xyz_seq');
alter table xyz alter column foo set default '';
COMMIT;
Also, are you sure you want '' as a column default, and not ALTER COLUMN foo DROP DEFAULT?
-Owen
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 19:45 Maciej Piekielniak <piechcio@isb.com.pl>
0 siblings, 0 replies; 22+ messages in thread
From: Maciej Piekielniak @ 2006-02-15 19:45 UTC (permalink / raw)
To: pgsql-sql
Hello Owen,
Wednesday, February 15, 2006, 8:31:17 PM, you wrote:
OJ> Note that prior to 8.0 PostgreSQL does not support multiple ALTER actions in a single query. To get an equivalent effect, wrap separate ALTER TABLE queries in a transaction:
OJ> BEGIN;
OJ> alter table xyz alter column id set default nextval('xyz_seq');
OJ> alter table xyz alter column foo set default '';
OJ> COMMIT;
OJ> Also, are you sure you want '' as a column default, and not ALTER COLUMN foo DROP DEFAULT?
OJ> -Owen
OK. THX. Second question:
First, maybe set many fields with the same action - ex. set default?
Ex. on mysql
ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
MODIFY specific_name char(64) DEFAULT '' NOT NULL,
MODIFY sql_data_access
enum('CONTAINS_SQL',
'NO_SQL',
'READS_SQL_DATA',
'MODIFIES_SQL_DATA'
) DEFAULT 'CONTAINS_SQL' NOT NULL....
Second, can i modify more than 1 option with alter table on one field?:
ex (mysql):
ALTER TABLE proc MODIFY name varchar(64) DEFAULT '' NOT NULL;
--
Best regards,
Maciej mailto:piechcio@isb.com.pl
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 19:56 Owen Jacobson <ojacobson@osl.com>
0 siblings, 2 replies; 22+ messages in thread
From: Owen Jacobson @ 2006-02-15 19:56 UTC (permalink / raw)
To: Maciej Piekielniak <piechcio@isb.com.pl>; +Cc: pgsql-sql
Maciej Piekielniak wrote:
>
> Wednesday, February 15, 2006, 8:31:17 PM, you wrote:
> OJ> Note that prior to 8.0 PostgreSQL does not support
> multiple ALTER actions in a single query. To get an
> equivalent effect, wrap separate ALTER TABLE queries in a transaction:
>
> OJ> BEGIN;
> OJ> alter table xyz alter column id set default nextval('xyz_seq');
> OJ> alter table xyz alter column foo set default '';
> OJ> COMMIT;
> OJ> Also, are you sure you want '' as a column default, and
> not ALTER COLUMN foo DROP DEFAULT?
> OJ> -Owen
>
> OK. THX. Second question:
>
> First, maybe set many fields with the same action - ex. set default?
>
> Ex. on mysql
>
> ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
> MODIFY specific_name char(64) DEFAULT '' NOT NULL,
> MODIFY sql_data_access
> enum('CONTAINS_SQL',
> 'NO_SQL',
> 'READS_SQL_DATA',
> 'MODIFIES_SQL_DATA'
> ) DEFAULT 'CONTAINS_SQL' NOT NULL....
Under PostgreSQL 7.4 you'd need to do those as three separate ALTER TABLE statements:
BEGIN;
ALTER TABLE proc ALTER name DEFAULT '' NOT NULL;
ALTER TABLE proc ALTER specific_name DEFAULT '' NOT NULL;
... and so on ...
COMMIT;
Note that ALTER TABLE under postgresql cannot change a column's type (including precision or length). You can fake it by renaming the existing column, creating a new column of the appropriate type, UPDATEing data from the old column to the new column, [setting the new column's constraints,] and finally removing the old column, but it's a long-winded process.
> Second, can i modify more than 1 option with alter table on
> one field?:
>
> ex (mysql):
> ALTER TABLE proc MODIFY name varchar(64) DEFAULT '' NOT NULL;
Not under 7.4.
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 20:03 Stephan Szabo <sszabo@megazone.bigpanda.com>
parent: Owen Jacobson <ojacobson@osl.com>
1 sibling, 1 reply; 22+ messages in thread
From: Stephan Szabo @ 2006-02-15 20:03 UTC (permalink / raw)
To: Owen Jacobson <ojacobson@osl.com>; +Cc: Maciej Piekielniak <piechcio@isb.com.pl>; pgsql-sql
On Wed, 15 Feb 2006, Owen Jacobson wrote:
> Maciej Piekielniak wrote:
> >
> > Wednesday, February 15, 2006, 8:31:17 PM, you wrote:
> > OJ> Note that prior to 8.0 PostgreSQL does not support
> > multiple ALTER actions in a single query. To get an
> > equivalent effect, wrap separate ALTER TABLE queries in a transaction:
> >
> > OJ> BEGIN;
> > OJ> alter table xyz alter column id set default nextval('xyz_seq');
> > OJ> alter table xyz alter column foo set default '';
> > OJ> COMMIT;
> > OJ> Also, are you sure you want '' as a column default, and
> > not ALTER COLUMN foo DROP DEFAULT?
> > OJ> -Owen
> >
> > OK. THX. Second question:
> >
> > First, maybe set many fields with the same action - ex. set default?
> >
> > Ex. on mysql
> >
> > ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
> > MODIFY specific_name char(64) DEFAULT '' NOT NULL,
> > MODIFY sql_data_access
> > enum('CONTAINS_SQL',
> > 'NO_SQL',
> > 'READS_SQL_DATA',
> > 'MODIFIES_SQL_DATA'
> > ) DEFAULT 'CONTAINS_SQL' NOT NULL....
>
> Under PostgreSQL 7.4 you'd need to do those as three separate ALTER TABLE statements:
>
> BEGIN;
> ALTER TABLE proc ALTER name DEFAULT '' NOT NULL;
> ALTER TABLE proc ALTER specific_name DEFAULT '' NOT NULL;
> ... and so on ...
> COMMIT;
>
> Note that ALTER TABLE under postgresql cannot change a column's type
> (including precision or length).
Not in 7.4, but I believe 8.1 allows that (ALTER TABLE ALTER COLUMN TYPE
with semi-optional USING)
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 20:05 Maciej Piekielniak <piechcio@isb.com.pl>
parent: Owen Jacobson <ojacobson@osl.com>
1 sibling, 0 replies; 22+ messages in thread
From: Maciej Piekielniak @ 2006-02-15 20:05 UTC (permalink / raw)
To: Owen Jacobson <ojacobson@osl.com>; +Cc: pgsql-sql
Hello Owen,
Wednesday, February 15, 2006, 8:56:05 PM, you wrote:
>> ALTER TABLE proc MODIFY name varchar(64) DEFAULT '' NOT NULL;
OJ> Not under 7.4.
Hmm, maybe postgres can copy constraints and properties in "create table .. as select"?
CREATE TABLE fv_wystawione
( abonament) AS SELECT a.nazwa from abonamenty a;
This command only copy data type.
--
Best regards,
Maciej mailto:piechcio@isb.com.pl
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 20:09 Owen Jacobson <ojacobson@osl.com>
0 siblings, 0 replies; 22+ messages in thread
From: Owen Jacobson @ 2006-02-15 20:09 UTC (permalink / raw)
To: Maciej Piekielniak <piechcio@isb.com.pl>; +Cc: pgsql-sql
Maciej Piekielniak wrote:
>
> Hello Owen,
>
> Wednesday, February 15, 2006, 8:56:05 PM, you wrote:
> >> ALTER TABLE proc MODIFY name varchar(64) DEFAULT '' NOT NULL;
>
> OJ> Not under 7.4.
>
> Hmm, maybe postgres can copy constraints and properties in
> "create table .. as select"?
What is it you're actually trying to accomplish? There's got to be a better way, but without understanding what you're doing (rather than how) it's hard to give you advice.
CREATE TABLE AS and SELECT INTO only reproduce data, not metadata. AFAIK duplicating a table's constraints involves fishing around in the pg_ system tables.
-Owen
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-15 20:29 Maciej Piekielniak <piechcio@isb.com.pl>
parent: Stephan Szabo <sszabo@megazone.bigpanda.com>
0 siblings, 0 replies; 22+ messages in thread
From: Maciej Piekielniak @ 2006-02-15 20:29 UTC (permalink / raw)
To: Stephan Szabo <sszabo@megazone.bigpanda.com>; +Cc: pgsql-sql
Hello Stephan,
Wednesday, February 15, 2006, 9:03:26 PM, you wrote:
SS> Not in 7.4, but I believe 8.1 allows that (ALTER TABLE ALTER COLUMN TYPE
SS> with semi-optional USING)
Thx for all.
--
Best regards,
Maciej mailto:piechcio@isb.com.pl
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: alter table
@ 2006-02-16 00:54 Michael Glaesemann <grzm@myrealbox.com>
parent: Maciej Piekielniak <piechcio@isb.com.pl>
1 sibling, 0 replies; 22+ messages in thread
From: Michael Glaesemann @ 2006-02-16 00:54 UTC (permalink / raw)
To: Maciej Piekielniak <piechcio@isb.com.pl>; +Cc: pgsql-sql
On Feb 16, 2006, at 3:11 , Maciej Piekielniak wrote:
> How can i modify few fields with alter?
I think you need to alter columns one at a time. If you need them to
go into effect at the same time, you can wrap the multiple ALTER
TABLE statements in a transaction. For example,
begin;
ALTER TABLE fv_wystawione ALTER id_fv SET DEFAULT nextval
('id_fv_seq'::text);
ALTER TABLE fv_wystawione ALTER imie SET DEFAULT '';
commit;
Michael Glaesemann
grzm myrealbox com
^ permalink raw reply [nested|flat] 22+ messages in thread
* Alter Table
@ 2007-03-15 13:35 Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
0 siblings, 2 replies; 22+ messages in thread
From: Shavonne Marietta Wijesinghe @ 2007-03-15 13:35 UTC (permalink / raw)
To: pgsql-sql
When i alter a table and add a new column it always adds it to the end of the table. Is there any way to tell it to add the new column at the 5th position or to add the new column after a surtain column.
Thanks
Shavonne Wijesinghe
http://www.studioform.it
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: Alter Table
@ 2007-03-15 13:46 A. Kretschmer <andreas.kretschmer@schollglas.com>
parent: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
1 sibling, 0 replies; 22+ messages in thread
From: A. Kretschmer @ 2007-03-15 13:46 UTC (permalink / raw)
To: pgsql-sql
am Thu, dem 15.03.2007, um 14:35:41 +0100 mailte Shavonne Marietta Wijesinghe folgendes:
> When i alter a table and add a new column it always adds it to the end of the
> table. Is there any way to tell it to add the new column at the 5th position or
> to add the new column after a surtain column.
No, but you can (and should) define the column-order in the select-statement.
Other solutions:
- define a VIEW
- recreate the table
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
^ permalink raw reply [nested|flat] 22+ messages in thread
* Re: Alter Table
@ 2007-03-15 16:13 Scott Marlowe <smarlowe@g2switchworks.com>
parent: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
1 sibling, 0 replies; 22+ messages in thread
From: Scott Marlowe @ 2007-03-15 16:13 UTC (permalink / raw)
To: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>; +Cc: pgsql-sql
On Thu, 2007-03-15 at 08:35, Shavonne Marietta Wijesinghe wrote:
> When i alter a table and add a new column it always adds it to the end
> of the table. Is there any way to tell it to add the new column at the
> 5th position or to add the new column after a surtain column.
No, but the good news is you can just recreate the table once it's
stabilized in form with something like:
create table new_table as select field1, field4, field2, field3 from
old_table;
^ permalink raw reply [nested|flat] 22+ messages in thread
end of thread, other threads:[~2007-03-15 16:13 UTC | newest]
Thread overview: 22+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08 07:22 Alter table Rachel.Vaudron <rachel@lazaret.unice.fr>
2002-11-08 08:44 ` Tomasz Myrta <jasiek@klaster.net>
2002-11-08 08:50 ` Rachel.Vaudron <rachel@lazaret.unice.fr>
2002-11-08 13:24 ` Daniel Schuchardt <daniel_schuchardt@web.de>
2004-03-10 16:58 Alter table David <de4@kent.ac.uk>
2004-03-10 17:55 ` scott.marlowe <scott.marlowe@ihs.com>
2006-02-15 18:11 alter table Maciej Piekielniak <piechcio@isb.com.pl>
2006-02-15 18:54 ` Re: alter table Andreas Kretschmer <akretschmer@spamfence.net>
2006-02-15 19:23 ` Re: alter table Maciej Piekielniak <piechcio@isb.com.pl>
2006-02-15 19:27 ` Re: alter table Andreas Kretschmer <akretschmer@spamfence.net>
2006-02-15 19:30 ` Re: alter table Maciej Piekielniak <piechcio@isb.com.pl>
2006-02-16 00:54 ` Re: alter table Michael Glaesemann <grzm@myrealbox.com>
2006-02-15 19:31 Re: alter table Owen Jacobson <ojacobson@osl.com>
2006-02-15 19:45 Re: alter table Maciej Piekielniak <piechcio@isb.com.pl>
2006-02-15 19:56 Re: alter table Owen Jacobson <ojacobson@osl.com>
2006-02-15 20:03 ` Re: alter table Stephan Szabo <sszabo@megazone.bigpanda.com>
2006-02-15 20:29 ` Re: alter table Maciej Piekielniak <piechcio@isb.com.pl>
2006-02-15 20:05 ` Re: alter table Maciej Piekielniak <piechcio@isb.com.pl>
2006-02-15 20:09 Re: alter table Owen Jacobson <ojacobson@osl.com>
2007-03-15 13:35 Alter Table Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
2007-03-15 13:46 ` Re: Alter Table A. Kretschmer <andreas.kretschmer@schollglas.com>
2007-03-15 16:13 ` Re: Alter Table Scott Marlowe <smarlowe@g2switchworks.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox