Re: [PATCHES] ALTER TABLE modifications

2003-11-16 Thread Hannu Krosing
Rod Taylor kirjutas L, 08.11.2003 kell 18:55: A general re-organization of Alter Table. Node wise, it is a AlterTableStmt with a list of AlterTableCmds. The Cmds are the individual actions to be completed (Add constraint, drop constraint, add column, etc.) Processing is done in 2 phases.

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Dave Cramer
Rod, I tried the current patch on a RC2 release, and I noticed one undesirable side affect. Modifying a column moves it to the end. In high availability situations this would not be desirable, I would imagine it would break lots of code. Dave On Thu, 2003-11-13 at 11:35, Hannu Krosing wrote:

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Alvaro Herrera
On Fri, Nov 14, 2003 at 08:59:05AM -0500, Dave Cramer wrote: I tried the current patch on a RC2 release, and I noticed one undesirable side affect. Modifying a column moves it to the end. In high availability situations this would not be desirable, I would imagine it would break lots of

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Hannu Krosing
Alvaro Herrera kirjutas R, 14.11.2003 kell 16:17: On Fri, Nov 14, 2003 at 08:59:05AM -0500, Dave Cramer wrote: I tried the current patch on a RC2 release, and I noticed one undesirable side affect. Modifying a column moves it to the end. In high availability situations this would

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Peter Eisentraut
Rod Taylor writes: The method is rename old column, add new column, move data across, move or reform dependencies, drop old column. I can do this by hand. If we have an explicit command to do it, then it needs to preserve the table schema. Else, this feature would be mostly useless and a

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Rod Taylor
On Fri, 2003-11-14 at 09:57, Peter Eisentraut wrote: Rod Taylor writes: The method is rename old column, add new column, move data across, move or reform dependencies, drop old column. I can do this by hand. If we have an explicit command to do it, then it needs to preserve the table

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Dave Cramer
OK, Here is another approach, that would retain column order. It will require that the table be locked while this proceeds, but I think this is a good idea anyway. lock table create newtable as select c1, c2, c3::newtype modify pg_class to point to the new filename modify existing pg_attribute

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Tom Lane
Rod Taylor [EMAIL PROTECTED] writes: On Fri, 2003-11-14 at 09:57, Peter Eisentraut wrote: I can do this by hand. If we have an explicit command to do it, then it needs to preserve the table schema. Else, this feature would be mostly useless and a certain source of complaints. The method

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Rod Taylor
lock table create newtable as select c1, c2, c3::newtype modify pg_class to point to the new filename modify existing pg_attribute for the column in question recreate indexes that exist on the column unlock table I actually tried this to start with an ran into several dead-ends in trying to

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Peter Eisentraut
Tom Lane writes: I believe the consensus was that automating what you could do by hand is still a step forward. I don't recall that, but if so, I would like to revisit that consensus. AFAICT, this patch does not buy us anything at all. It's just a different spelling of existing

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Christopher Kings-Lynne
This is expected. Doing otherwise would incur into a much bigger performance hit. Anyway, IMHO no code should use SELECT * in any case, which is the only scenario where one would expect physical column order to matter, isn't it? Well, we can always bring back the old idea of a attlognum which is

Re: [PATCHES] ALTER TABLE modifications

2003-11-14 Thread Christopher Kings-Lynne
I guess the real question here is whether we would want to revert this capability if a patch to adjust logical column orderings doesn't appear before 7.5. My vote would be no, but apparently Peter's is yes. Any other opinions? The fact that it deals with the nightmare of dropping and recreating

Re: [PATCHES] ALTER TABLE modifications

2003-11-13 Thread Hannu Krosing
Peter Eisentraut kirjutas K, 12.11.2003 kell 21:02: Rod Taylor writes: ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol 3); The above combinational syntax is commented out in gram.y. The support framework is used in both the above and below items, but

Re: [PATCHES] ALTER TABLE modifications

2003-11-13 Thread Peter Eisentraut
Hannu Krosing writes: Please don't use the term transform. It is used by the SQL standard for other purposes. Is the other use conflicting with this syntax ? I think we have preferred reusing existing keywords to adding new ones in the past. Maybe (although I don't agree). but we've

Re: [PATCHES] ALTER TABLE modifications

2003-11-12 Thread Rod Taylor
On Tue, 2003-11-11 at 23:46, Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] writes: Is this to be applied to CVS HEAD? It sounded like large portions were still at the request-for-comment stage... It can be applied to -HEAD without breaking anything or backtracking in feature set (that I

Re: [PATCHES] ALTER TABLE modifications

2003-11-12 Thread Peter Eisentraut
Rod Taylor writes: ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol 3); The above combinational syntax is commented out in gram.y. The support framework is used in both the above and below items, but arbitrary statements probably have some issues --

Re: [PATCHES] ALTER TABLE modifications

2003-11-12 Thread Rod Taylor
On Wed, 2003-11-12 at 14:02, Peter Eisentraut wrote: Rod Taylor writes: ALTER TABLE tab ADD COLUMN col DEFAULT 3, ADD CHECK (anothercol 3); I think it's perfectly fine to write two separate ALTER TABLE statements. No need to introduce this nonstandard syntax. Yes, it is certainly fine to

Re: [PATCHES] ALTER TABLE modifications

2003-11-11 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Is this to be applied to CVS HEAD? It sounded like large portions were still at the request-for-comment stage... regards, tom lane ---(end of broadcast)--- TIP 8: explain analyze is