On Sat, Aug 12, 2006 at 11:53:08AM +0000, Emil J. wrote:
Quote:
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
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org