delay of function

Поиск
Список
Период
Сортировка
Искать
От
Jaromír Kamler
Тема
delay of function
Дата
Msg-id
200603011757.1269@centrum.cz
Список
Дерево обсуждения
delay of function " Jaromír Kamler" <kamler@centrum.cz>
Re: delay of function Michael Fuhr <mike@fuhr.org>
Re: delay of function Michael Fuhr <mike@fuhr.org>
Re: delay of function " Jaromír Kamler" <kamler@centrum.cz>
Re: delay of function Michael Fuhr <mike@fuhr.org>
Re: delay of function " Jaromír Kamler" <kamler@centrum.cz>
Re: delay of function Michael Fuhr <mike@fuhr.org>
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

В списке pgsql-novice по дате отправления
От: Steve Crawford
Дата:
Сообщение: Re: install problems
От: Bruno Wolff III
Дата:
Сообщение: Re: install problems
FAQ