8.1.3, libpq, PQprepare, plpgsql function, and partitioned tables

Поиск
Список
Период
Сортировка
От shakahshakah@gmail.com
Тема 8.1.3, libpq, PQprepare, plpgsql function, and partitioned tables
Дата
Msg-id 1143871728.489728.195430@t31g2000cwb.googlegroups.com
обсуждение исходный текст
Ответы Re: 8.1.3, libpq, PQprepare, plpgsql function, and partitioned tables  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I have some long-running processes which connect to Postgres, use
PQprepare on a function call, and use PQexecPrepared to effectively
insert rows into a set of partitioned tables (by month).

In a nutshell, up until yesterday I had a base widgets table and a
widgets_200603 table, an INSERT rule in front of widgets to insert into
200603 based on a timestamp column, and an INSERT trigger on the base
table to reject inserts into it (nothing special, just following
section 5.9.2 in the 8.1.3 docs). The processes in question were
started in early Mar 2006, everything worked fine.

Yesterday (31 Mar) I created a widgets_200604 table and a rule & used
psql to verify that the "insert function" indeed placed rows in the new
table when appropriate (based on the timestamp value). However, I just
noticed that the inserts from the existing processes were rejected as
if the new rule was not there. Bouncing the processes fixed things, I
assume because the call to the "insert function" was prepared anew.

Am I correct in assuming that when Postgres prepared the SQL to execute
the "insert function" that the existing rules on the base table were
also resolved at that time?  If so, is there any way to avoid that
behavior?

In case it isn't clear, by the way, the "insert function" mentioned
above is roughly:

CREATE OR REPLACE FUNCTION insert_widget(...) RETURNS void AS $$
BEGIN
  INSERT INTO widgets(...) VALUES(...) ;
  RETURN ;
END ;
$$ LANGUAGE plpgsql ;


В списке pgsql-general по дате отправления:

Предыдущее
От: "fufay"
Дата:
Сообщение: Re: installation problem - semaphores
Следующее
От: Chris
Дата:
Сообщение: Re: Cant find temp tables