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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-bugs by date

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