Re: [SQL] Alter Table/Indexing

2009-03-25 Thread Steve Midgley
At 02:20 AM 3/25/2009, pgsql-sql-ow...@postgresql.org wrote: To: Zdravko Balorda cc: pgsql-sql@postgresql.org Subject: Re: Alter Table/Indexing In-reply-to: <49c89fea.8060...@siix.com> References: <49c89fea.8060...@siix.com> Comments: In-reply-to Zdravko Balorda message dated "Tue, 24 M

Re: [SQL] Alter Table/Indexing

2009-03-24 Thread Tom Lane
Zdravko Balorda writes: > I wonder does ATER TABLE TYPE, SET, depends on indexes, like INSERT does > in a sense it may be faster to drop and recreate index than sorting > after every row inserted. ALTER TABLE TYPE already rebuilds the indexes; you won't make the overall process any faster by doi

Re: [SQL] alter table on a large db

2009-03-24 Thread Jasen Betts
On 2009-03-19, Zdravko Balorda wrote: > > Hi, > > I need to make some ALTER TABLEs. It takes about 30min to copy > this quite large databse, bat several ours to run a bunch of ALTER > TABLE statements. which do you prefer 30 minutes down-time to reload the database or a few hours wait to update i

[SQL] Alter Table/Indexing

2009-03-24 Thread Zdravko Balorda
Hi, I wonder does ATER TABLE TYPE, SET, depends on indexes, like INSERT does in a sense it may be faster to drop and recreate index than sorting after every row inserted. Does changing type or setting default on an indexed column require sorting? Thanks, Zdravko -- Sent via pgsql-sql mail

Re: [SQL] alter table on a large db

2009-03-19 Thread Scott Marlowe
On Thu, Mar 19, 2009 at 1:57 AM, Zdravko Balorda wrote: > > Hi, > > I need to make some ALTER TABLEs. It takes about 30min to copy > this quite large databse, bat several ours to run a bunch of ALTER > TABLE statements. > Is there any way to make it faster? I wonder what could possibly alter table

Re: [SQL] alter table on a large db

2009-03-19 Thread Achilleas Mantzios
Στις Thursday 19 March 2009 09:57:11 ο/η Zdravko Balorda έγραψε: > > Hi, > > I need to make some ALTER TABLEs. It takes about 30min to copy > this quite large databse, bat several ours to run a bunch of ALTER > TABLE statements. > Is there any way to make it faster? I wonder what could possibly a

[SQL] alter table on a large db

2009-03-19 Thread Zdravko Balorda
Hi, I need to make some ALTER TABLEs. It takes about 30min to copy this quite large databse, bat several ours to run a bunch of ALTER TABLE statements. Is there any way to make it faster? I wonder what could possibly alter table be doing all this time. Regards, Zdravko. -- Sent via pgsql-sq

Re: [SQL] ALTER TABLE DROP CONSTRAINT IF EXISTS ?

2008-01-24 Thread Scott Marlowe
On Jan 23, 2008 4:25 AM, Andreas Joseph Krogh <[EMAIL PROTECTED]> wrote: > Does PG have any way of doing $subject without writing a plpgsql-function > which does it by querying the catalog manually? No. ---(end of broadcast)--- TIP 6: explain analyz

[SQL] ALTER TABLE DROP CONSTRAINT IF EXISTS ?

2008-01-23 Thread Andreas Joseph Krogh
Does PG have any way of doing $subject without writing a plpgsql-function which does it by querying the catalog manually? I'm looking for an equivalent of "DROP TABLE IF EXISTS " -- Andreas Joseph Krogh <[EMAIL PROTECTED]> Senior Software Developer / Manager +---

[SQL] alter table table add column

2007-07-30 Thread Ronald Rojas
Hi, Anybody knows how to add column with reference to BEFORE or AFTER any given column? Let say here's my table structure: Column | Type| Modifiers --+---+--- surname | character varying | lastname | character varying | address | character

Re: [SQL] Alter Table

2007-03-15 Thread Scott Marlowe
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 i

Re: [SQL] Alter Table

2007-03-15 Thread A. Kretschmer
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 col

[SQL] Alter Table

2007-03-15 Thread Shavonne Marietta Wijesinghe
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

Re: [SQL] alter table

2006-02-15 Thread Michael Glaesemann
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

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
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, Maciejmailto:[EMAIL PROTECTED] ---

Re: [SQL] alter table

2006-02-15 Thread Stephan Szabo
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 qu

Re: [SQL] alter table

2006-02-15 Thread Owen Jacobson
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

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
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

Re: [SQL] alter table

2006-02-15 Thread Owen Jacobson
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

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
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

Re: [SQL] alter table

2006-02-15 Thread Owen Jacobson
, 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 n

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Andreas, Wednesday, February 15, 2006, 8:27:00 PM, you wrote: AK> test=# select version(); AK>version AK> -- AK> PostgreSQL 8.1.2

Re: [SQL] alter table

2006-02-15 Thread Andreas Kretschmer
Maciej Piekielniak <[EMAIL PROTECTED]> 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 ''; > > PGA

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
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 c

Re: [SQL] alter table

2006-02-15 Thread Andreas Kretschmer
Maciej Piekielniak <[EMAIL PROTECTED]> 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 sequ

[SQL] alter table

2006-02-15 Thread Maciej Piekielniak
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:[EMAIL PROTECTED] ---(en

Re: [SQL] Alter table

2004-03-10 Thread scott.marlowe
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 ch

[SQL] Alter table

2004-03-10 Thread David
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 ---(end of broadcast)--- TIP 8: exp

Re: [SQL] ALTER TABLE ... DROP CONSTRAINT

2003-07-30 Thread Rajesh Kumar Mallah
if the constraint are named $1 $2 etc you will need to quote them eg ALTER TABLE xyz DROP CONSTRAINT "$1" ; in some version you may require ALTER TABLE xyz DROP CONSTRAINT "$1" RESTRICT; What is ur version btw? try to post the table structure also. regds mallah. Elielson Fontanezi wrote: H

Re: [SQL] ALTER TABLE ... DROP CONSTRAINT

2003-07-30 Thread George Weaver
It works in 7.3.2.   George - Original Message - From: Elielson Fontanezi To: pgsql-general ; pgsql-sql Sent: Wednesday, July 30, 2003 10:52 AM Subject: [SQL] ALTER TABLE ... DROP CONSTRAINT Hi all!       Who can tell me what postgres version supports

Re: [SQL] ALTER TABLE ... DROP CONSTRAINT

2003-07-30 Thread Rod Taylor
I think you can do some constraints in 7.2, but 7.3 will allow dropping them all in that fashion. On Wed, 2003-07-30 at 11:52, Elielson Fontanezi wrote: > Hi all! > > Who can tell me what postgres version supports ALTER TABLE... DROP > CONSTRAINT without > the need of droping the table to re

Re: [SQL] ALTER TABLE ... DROP CONSTRAINT

2003-07-30 Thread Chad Thompson
  Hi all!       Who can tell me what postgres version supports ALTER TABLE... DROP CONSTRAINT without the need of droping the table to remove a simple coinstraint. (link)    >\\\!/< 55 11 5080 9283 

[SQL] ALTER TABLE ... DROP CONSTRAINT

2003-07-30 Thread Elielson Fontanezi
Hi all!       Who can tell me what postgres version supports ALTER TABLE... DROP CONSTRAINT without the need of droping the table to remove a simple coinstraint. (link)    >\\\!/< 55 11 5080 9283   !_"""_! Elielson

[SQL] ALTER TABLE x DROP CONSTRAINT fkey

2002-11-29 Thread Thomas Good
Pardon stupidiy, what is the right syntax for dropping a foreign key? Struggling here! TIA --- Thomas Good e-mail: [EMAIL PROTECTED] Programmer/Analyst phone: (+1) 718.

Re: [SQL] Alter table

2002-11-08 Thread Daniel Schuchardt
I think 7.3 has this feature. Daniel ""Rachel.Vaudron"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:Pine.LNX.4.33.0211080811160.12232-10@;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

Re: [SQL] Alter table

2002-11-08 Thread Rachel.Vaudron
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 -

Re: [SQL] Alter table

2002-11-08 Thread Tomasz Myrta
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 fiel

[SQL] Alter table

2002-11-07 Thread Rachel.Vaudron
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 ** [EMAIL PROTECTED] Laboratoire de prehistoire

Re: [SQL] Alter Table problems

2001-04-27 Thread Stephan Szabo
On Fri, 27 Apr 2001, Scott David Walter wrote: > I am attempting to add a few attributes to an existing table that already > contains data. The problem that I am having is that the new attributes > that I want to add need to be forgein key references to other tables. I > can't figure out how to

[SQL] Alter Table problems

2001-04-27 Thread Scott David Walter
I am attempting to add a few attributes to an existing table that already contains data. The problem that I am having is that the new attributes that I want to add need to be forgein key references to other tables. I can't figure out how to create the attribute with a reference to another table.

[SQL] alter table question

2000-11-29 Thread Joseph Shraibman
How do I alter a table to set a column to be not null? -- Joseph Shraibman [EMAIL PROTECTED] Increase signal to noise ratio. http://www.targabot.com

Re: [SQL] alter table add column implementation undesirable?

2000-11-09 Thread Tom Lane
Forest Wilkinson <[EMAIL PROTECTED]> writes: > A coworker told me that the postgres implementation of ALTER TABLE ADD > COLUMN creates an inefficient database. Dunno where he got that idea. There are some problems lurking in ADD COLUMN when used on a table with inheritance children --- the new c

[SQL] alter table add column implementation undesirable?

2000-11-09 Thread Forest Wilkinson
A coworker told me that the postgres implementation of ALTER TABLE ADD COLUMN creates an inefficient database. He said it results in a table whose new column is stored someplace other than the rest of the columns. (A hidden auxiliary table?) Is this true in postgres 6.5.3? 7.x? Was it ever tru

[SQL] ALTER TABLE ADD COLUMN syntax question.

2000-07-05 Thread Robert B. Easter
I used the command below to alter a table and it took with no problem, but the REFERENCES appears to have been ignored since I can put invalid numbers into last_post_id. Are there plans to add the ability to specify column constrainsts with ALTER TABLE ADD COLUMN in the future? For now, I suppo