Treat an updateable View as a Table in Grid editor?

Поиск
Список
Период
Сортировка
От Harald Armin Massa
Тема Treat an updateable View as a Table in Grid editor?
Дата
Msg-id 7be3f35d0610050030g43cde42av89d0ee03fe353f7@mail.gmail.com
обсуждение исходный текст
Ответы Re: Treat an updateable View as a Table in Grid editor?
Список pgadmin-support
<br />I created a time-constraint table ... that is, rows have a valid-timespan (validvon - validbis, as in "valid
from"- "valid until", with German intermixed)<br /><br />CREATE TABLE otlabel<br />(<br />  id_label serial NOT NULL,
<br/>  id_lg integer,<br />  name_l text,<br />  letztespeicherung timestamp without time zone DEFAULT now(),<br /> 
id_pklserial NOT NULL,<br />  validvon timestamp without time zone DEFAULT '-infinity'::timestamp without time zone,
<br/>  validbis timestamp without time zone DEFAULT 'infinity'::timestamp without time zone,<br />  id_user integer
DEFAULT0,<br />  quarant integer DEFAULT 0,<br />  CONSTRAINT otlabel_pkey PRIMARY KEY (id_pkl),<br />) <br />WITHOUT
OIDS;<br />ALTER TABLE otlabel OWNER TO ibox;<br /><br />to make it userproof, selecting, inserting, updating and
deletinghas to be done with a view:<br /><br />CREATE OR REPLACE VIEW label AS <br /> SELECT otlabel.id_label,
otlabel.id_lg, otlabel.name_l, otlabel.letztespeicherung<br />   FROM otlabel<br />  WHERE now() >= otlabel.validvon
ANDnow() <= otlabel.validbis AND otlabel.quarant = get_quarant();<br /><br />CREATE OR REPLACE RULE label_delete
AS<br/>     ON DELETE TO label DO INSTEAD  UPDATE otlabel SET validbis = now(), letztespeicherung = now()<br />  WHERE
otlabel.id_label= old.id_label AND otlabel.validbis >= '9999-12-31 00:00:00'::timestamp without time zone AND
otlabel.quarant= get_quarant();<br /><br />CREATE OR REPLACE RULE label_insert AS<br />    ON INSERT TO label DO
INSTEAD INSERT INTO otlabel (id_label, id_lg, name_l, letztespeicherung, validvon, validbis, id_user, quarant) <br />  
VALUES(new.id_label, new.id_lg, new.name_l, now(), now(), 'infinity'::timestamp without time zone, get_user(),
get_quarant());<br/><br />CREATE OR REPLACE RULE label_update AS<br />    ON UPDATE TO label DO INSTEAD ( UPDATE
otlabelSET validbis = now(), letztespeicherung = now() <br />  WHERE otlabel.id_label = old.id_label AND
otlabel.validbis>= '9999-12-31 00:00:00'::timestamp without time zone AND otlabel.quarant = get_quarant();<br
/> INSERTINTO otlabel (id_label, id_lg, name_l, letztespeicherung, validvon, validbis, id_user, quarant) <br />  VALUES
(new.id_label,new.id_lg, new.name_l, now(), now(), 'infinity'::timestamp without time zone, get_user(),
get_quarant());<br/>);<br /><br />Now I would be VERY VERY happy if I could trick pgAdmin into allowing me to edit this
viewwithin the Grid. <br /><br />Any chance now? Or only with wihslist for 1.7? Or not at all?<br /><br />Harald<br
/>--<br />GHUM Harald Massa<br />persuadere et programmare<br />Harald Armin Massa<br />Reinsburgstraße 202b<br />70197
Stuttgart<br/>0173/9409607 <br />-<br />Python: the only language with more web frameworks than keywords.  

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

Предыдущее
От: "Hiroshi Saito"
Дата:
Сообщение: Re: Bug report on insert with pgadmin
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: Treat an updateable View as a Table in Grid editor?