Skip site navigation (1) Skip section navigation (2)

Re: BUG #2572: ALTER TABLE ADD COLUMN

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: "Emil J(dot)" <emilj(at)pyton(dot)sk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2572: ALTER TABLE ADD COLUMN
Date: 2006-08-13 13:57:08
Message-ID: 20060813135708.GA27248@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-bugs
On Sat, Aug 12, 2006 at 11:53:08AM +0000, Emil J. wrote:
> I create some function (PLPGSQL):
> 
> .....
> BEGIN
>      ALTER TABLE sch.table ADD COLUMN abc INTEGER;
>      RETURN NULL;
> END;
> 
> After i called it, nothing happend. No Error, No Exception, No effect - no
> column added.

Works here.  Is it possible that the calling transaction rolled
back or that it hadn't committed yet and you looked at the table
in another transaction?  Can you provide a complete test case?

Example:

test=> CREATE TABLE foo (id integer);
CREATE TABLE
test=> CREATE FUNCTION test() RETURNS void AS $$
test$> BEGIN
test$>     ALTER TABLE foo ADD COLUMN newcol integer;
test$> END;
test$> $$ LANGUAGE plpgsql;
CREATE FUNCTION
test=> \d foo
      Table "public.foo"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 

test=> SELECT test();
 test 
------
 
(1 row)

test=> \d foo
      Table "public.foo"
 Column |  Type   | Modifiers 
--------+---------+-----------
 id     | integer | 
 newcol | integer | 

-- 
Michael Fuhr

In response to

pgsql-bugs by date

Next:From: Michael FuhrDate: 2006-08-13 15:40:36
Subject: Re: distance operator dont work
Previous:From: Emil J.Date: 2006-08-12 11:53:08
Subject: BUG #2572: ALTER TABLE ADD COLUMN

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group