Re: [HACKERS] INSERT into VIEW - Mailing list pgsql-hackers

From wieck@debis.com (Jan Wieck)
Subject Re: [HACKERS] INSERT into VIEW
Date
Msg-id m10qidf-0003kGC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to INSERT into VIEW  (Oleg Broytmann <phd@sun.med.ru>)
List pgsql-hackers
>
> Hello!
>
> PostgreSQL 6.4.2.
>
> ran=> create table t (some_number int4, some_string text);
> CREATE
> ran=> insert into t values(-1,'a');
> INSERT 20362 1
> ran=> insert into t values(1,'d');
> INSERT 20363 1
> ran=> create view v as select * from t where some_number>=0;
> CREATE
> ran=> insert into v values (17,'q');
> INSERT 20375 1
> ran=> select * from t;
> some_number|some_string
> -----------+-----------
>          -1|a
>           1|d
> (2 rows)
>
>    What is 20375? Is it real OID of dummy row?

    It's the OID of the real row that got stored into relation v.

    Do a

      DROP RULE "_RETv";
      SELECT * FROM v;

    and you'll get back your (17,'q') row.

    Maybe you should read now some chapters  in  the  programmers
    manual  about  the  implementation  of views, the rule system
    etc.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #

pgsql-hackers by date:

Previous
From: Don Baccus
Date:
Subject: Re: [HACKERS] Priorities for 6.6
Next
From: Oleg Bartunov
Date:
Subject: Re: [HACKERS] Priorities for 6.6