pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karthikeyan Sundaram <skarthi98@hotmail.com>
To: pgsql-admin@postgresql.org
To: pgsql-sql@postgresql.org
Subject: Re: create view with check option
Date: Mon, 19 Mar 2007 13:41:31 -0700
Message-ID: <BAY131-F21596D11D9A7E65E070E4FB0760@phx.gbl> (raw)
In-Reply-To: <BAY131-F39148BA6B3B5CE265CDE4EB0760@phx.gbl>

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@hotmail.com>
>To: pgsql-admin@postgresql.org, pgsql-sql@postgresql.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_te...
>
>
>---------------------------(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/ho...




view thread (6+ messages)

Message-ID: <BAY131-F21596D11D9A7E65E070E4FB0760@phx.gbl>
Permalink:  ../BAY131-F21596D11D9A7E65E070E4FB0760@phx.gbl/
Also on:    postgresql.org/message-id/BAY131-F21596D11D9A7E65E070E4FB0760@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: skarthi98@hotmail.com, pgsql-admin@postgresql.org
  Subject: Re: create view with check option
  In-Reply-To: <BAY131-F21596D11D9A7E65E070E4FB0760@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox