Re: Table partititon hakkında soru

From: Timu <timu(at)cetech(dot)biz>
To: Devrim GÜNDÜZ <devrim(at)commandprompt(dot)com>
Subject: Re: Table partititon hakkında soru
Date: 2007-10-04 15:54:24
Message-ID: 200710041854.27442.timu@cetech.biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-tr-genel

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 04 October 2007 18:25:07 you wrote:
> Merhaba,
>
> On Thu, 2007-10-04 at 18:19 +0300, Timu wrote:
> > partition tablolarda bulunan check constraintler'in kullandığı
> > fieldler üzerinde update işlemi gerçekleştiremiyorum
>
> Check constraintler UPDATE RESTRICT ile tanımlanmış olabilir mi?
>
> Bkz:
>
> http://www.gunduz.org/download.php?dlid=25
>
> Kolay gelsin,

Açıkcası her hangi bir durum belirtmedim. Yaptığım işlemleri sıra ile
veriyorum.

create table test(id bigserial not null, i integer not null);

create table test_1 (check(i = 1)) inherits(test);
create table test_2 (check(i = 2)) inherits(test);
create table test_3 (check(i = 3)) inherits(test);

create or replace rule test_1_rule AS ON INTSERT TO test WHERE (i = 1) DO
INSTEAD INSERT INTO test_1 (NEW.id, NEW.i);

create or replace rule test_2_rule AS ON INSERT TO test WHERE (i = 2) DO
INSTEAD INSERT INTO test_2 VALUES (NEW.id, NEW.i);

create or replace rule test_3_rule AS ON INSERT TO test WHERE (i = 3) DO
INSTEAD INSERT INTO test_3 VALUES (NEW.id, NEW.i);

insert into test (i) values (1);
insert into test (i) values (2);
insert into test (i) values (3);

select * from test;
id | i
- ----+---
1 | 1
2 | 2
3 | 3
(3 rows)

anager=# select * from test_1;
id | i
- ----+---
1 | 1
(1 row)

select * from test_2;
id | i
- ----+---
2 | 2

select * from test_3;
id | i
- ----+---
3 | 3

manager=# update test set i=1 where id=2;
ERROR: new row for relation "test_2" violates check
constraint "test_2_i_check"
manager=#

Not: Devrim bey kusura bakmayın shortcut'ların kurbanı oldum..

- --
Timu EREN <timu(at)cetech(dot)biz>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHBQyzcubzCFA5PLsRAqyFAJ9DVU9hCfm1B8cTfvgqacYDvzhG+ACeJbIp
wQdSS8fayJ1PFgJQtFyajHQ=
=sYqq
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-tr-genel by date

  From Date Subject
Next Message Timu 2007-10-04 15:56:47 Fwd: Re: Table partititon hakkında soru
Previous Message Devrim GÜNDÜZ 2007-10-04 15:54:19 Re: Table partititon hakkında soru