Re: create view with check option

From: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: create view with check option
Date: 2007-03-19 20:41:31
Message-ID: BAY131-F21596D11D9A7E65E070E4FB0760@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Hi everybody,

I have implemented in a different way as advised in the manual. I
thought this will be useful for everbody.

We don't have check option in the view. Instead we can create a rule to
make the view as insertable, updatable or delete.

Here is the script.

create table test_tbl (a int4, b int4, c varchar(30));

create or replace view test_vw as select * from test_tbl;

create or replace rule test_rule_ins as on insert to test_vw
do instead
insert into test_tbl values (new.a, new.b, new.c);

insert into test_vw (a, b) values (1,2);
insert into test_vw (a, b) values (3,4);

create or replace rule test_rule_upd as on update to test_vw
do instead
update test_tbl set a=new.a, b=new.b, c=new.c where a=new.a;

update test_vw set c='good' where a=1;

select * from test_vw;

regards
skarthi

>From: "Karthikeyan Sundaram" <skarthi98(at)hotmail(dot)com>
>To: pgsql-admin(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
>Subject: [ADMIN] create view with check option
>Date: Sun, 18 Mar 2007 22:38:05 -0700
>
>Hi Everybody,
>
> I have 2 versions of postgres 8.1.0 is my production version and 8.2.1
>is my development version.
>
> I am trying to create a view in my development version (8.2.3)
>
> create view chnl_vw as select * from channel with check option;
>
> I am getting an error message:
>
>[Error] Script lines: 1-1 --------------------------
>ERROR: WITH CHECK OPTION is not implemented
>Line: 1
>
> what does this mean? I looked at the 8.2.1 manual and found the create
>view has check option. But it says before 8.2 those options are
>unsupported.
>
> How can I make this command to work.
>
>Regards
>skarthi
>
>_________________________________________________________________
>5.5%* 30 year fixed mortgage rate. Good credit refinance. Up to 5 free
>quotes - *Terms
>https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h2a5d&s=4056&p=5117&disc=y&vers=910
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: explain analyze is your friend

_________________________________________________________________
i'm making a difference.Make every IM count for the cause of your choice.
Join Now.
http://clk.atdmt.com/MSN/go/msnnkwme0080000001msn/direct/01/?href=http://im.live.com/messenger/im/home/?source=hmtagline

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message August Zajonc 2007-03-19 21:45:20 Re: [Bulk] Re: Disconnecting non active (IDLE ) users
Previous Message Tom Lane 2007-03-19 17:35:10 Re: Problem migrating from 8.0.3 to 8.2.3

Browse pgsql-sql by date

  From Date Subject
Next Message Martin Marques 2007-03-19 22:00:21 Re: triple self-join crawling
Previous Message Jure Kodzoman 2007-03-19 18:35:59 Re: Encode