Re: BUG #2572: ALTER TABLE ADD COLUMN - Mailing list pgsql-bugs

From Michael Fuhr
Subject Re: BUG #2572: ALTER TABLE ADD COLUMN
Date
Msg-id 20060813135708.GA27248@winnie.fuhr.org
Whole thread Raw
In response to BUG #2572: ALTER TABLE ADD COLUMN  ("Emil J." <emilj@pyton.sk>)
List 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

pgsql-bugs by date:

Previous
From: "Emil J."
Date:
Subject: BUG #2572: ALTER TABLE ADD COLUMN
Next
From: Michael Fuhr
Date:
Subject: Re: distance operator dont work