Re: [HACKERS] INSERT into VIEW

Jan Wieck <wieck@debis.com>

From: wieck@debis.com (Jan Wieck)
To: phd2@earthling.net
Cc: pgsql-hackers@postgreSQL.org, ran@pirit.com
Date: 1999-06-06T19:31:23Z
Lists: 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) #