From: | " Jaromír Kamler" <kamler(at)centrum(dot)cz> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | delay of function |
Date: | 2006-03-01 16:57:34 |
Message-ID: | 200603011757.1269@centrum.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
hallo,
I use PostGIS ... .
I have table:
CREATE TABLE basic_metadata(name text,size text, ......);
Inside I want insert some records (name of new table, size of new table and etc.), so I created trigger on the table geometry_columns:
CREATE TRIGGER ins_metdta AFTER INSERT ON geometry_columns FOR EACH ROW EXECUTE PROCEDURE insert_new();
CREATE OR REPLACE FUNCTION insert_new() RETURNS trigger AS $$
DECLARE
str text;
BEGIN
str := 'insert into basic_metadata(name,size) values (\''||new.f_table_name||'\',\''||pg_size_pretty(pg_relation_size(new.f_table_name))||'\');';
raise notice '%', str;
execute str;
return null;
END;
$$ LANGUAGE PLPGSQL;
Every time, when is something inserted into table geometry_columns would trigger insert some data into the table basic_metadata, but it fail, becouse in that time when is inserted name of new table into geometry_columns is not created that new table physically and therefore I can't call function pg_relation_size(). It is created after that. So I need wait with calling that trigger until that new table is done or ...... ????? Does anybody have some solution?
Thanks for your advices,
Jaromír Kamler
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2006-03-01 17:58:24 | Re: delay of function |
Previous Message | Steve Crawford | 2006-03-01 16:57:30 | Re: install problems |