pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedConstraint Problem
13+ messages / 6 participants
[nested] [flat]
* Constraint Problem
@ 1999-09-30 08:05 Chairudin Sentosa Harjo <chai@prima.net.id>
1999-10-08 07:28 ` Re: Constraint Problem Claudio Tassi <claudio@janet.NOSPAM.it>
0 siblings, 1 reply; 13+ messages in thread
From: Chairudin Sentosa Harjo @ 1999-09-30 08:05 UTC (permalink / raw)
To: pgsql-sql
Dear Friends,
I have a very wierd problem. It should be obvious, but I can't
understand why.
I am using Postgresql 6.5.2, SuSe 6.2, Pentium III, Kernel Linux 2.2.10.
Please notice the error, it keeps saying ck_ngetest_disc_pin,
ck_ngetest_disc_country
is the cause of the problem.
I have inserted the correct value, but why keep giving error???
The wierdest part is, when I insert a value to field "disc_all", the
error mentioned
"ck_ngetest_disc_pin" !!!.... If the constraint was violated, the error
message
should be "ck_ngetest_disc_all".
create table ngetest
(
custnum int8 NOT NULL,
first_name varchar(15) NOT NULL,
service_type char NOT NULL,
sex char NOT NULL,
detailed_bill char NOT NULL,
ngetest_status char NOT NULL,
disc_all char,
disc_country char,
disc_pin char,
constraint pk_ngetest PRIMARY KEY (custnum),
constraint ck_ngetest_service_type check
(service_type = 'Y' or
service_type = 'N' or
service_type = 'G' or
service_type = 'M' or
service_type = 'O' or
service_type = 'D'),
constraint ck_ngetest_status check
(ngetest_status = 'A' or
ngetest_status = 'I' or
ngetest_status = 'S' or
ngetest_status = 'T'),
constraint ck_ngetest_disc_all check
(disc_all = 'Y' or
disc_all = 'N'),
constraint ck_ngetest_disc_country check
(disc_country = 'Y' or
disc_country = 'N'),
constraint ck_ngetest_disc_pin check
(disc_pin = 'Y' or
disc_pin = 'N')
);
insert into ngetest
(custnum, first_name, service_type, sex, detailed_bill, ngetest_status,
disc_all)
values
(1,'Bob','Y','M','Y','A','Y');
ERROR: ExecAppend: rejected due to CHECK constraint ck_ngetest_disc_pin
insert into ngetest
(custnum, first_name, service_type, sex, detailed_bill, ngetest_status,
disc_country)
values
(2,'Mike','Y','M','Y','A','Y');
ERROR: ExecAppend: rejected due to CHECK constraint ck_ngetest_disc_pin
insert into ngetest
(custnum, first_name, service_type, sex, detailed_bill, ngetest_status,
disc_pin)
values
(3,'John','Y','M','Y','A','Y');
ERROR: ExecAppend: rejected due to CHECK constraint
ck_ngetest_disc_country
Regards,
Chairudin Sentosa
************
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint Problem
1999-09-30 08:05 Constraint Problem Chairudin Sentosa Harjo <chai@prima.net.id>
@ 1999-10-08 07:28 ` Claudio Tassi <claudio@janet.NOSPAM.it>
0 siblings, 0 replies; 13+ messages in thread
From: Claudio Tassi @ 1999-10-08 07:28 UTC (permalink / raw)
To: pgsql-sql
Chairudin Sentosa Harjo <chai@prima.net.id> wrote in message
news:37F319C6.FA5B5536@prima.net.id...
> Dear Friends,
>
> I have a very wierd problem. It should be obvious, but I can't
> understand why.
>
> I am using Postgresql 6.5.2, SuSe 6.2, Pentium III, Kernel Linux 2.2.10.
>
> Please notice the error, it keeps saying ck_ngetest_disc_pin,
> ck_ngetest_disc_country
> is the cause of the problem.
> I have inserted the correct value, but why keep giving error???
>
> The wierdest part is, when I insert a value to field "disc_all", the
> error mentioned
> "ck_ngetest_disc_pin" !!!.... If the constraint was violated, the error
> message
> should be "ck_ngetest_disc_all".
>
>
> create table ngetest
> (
> custnum int8 NOT NULL,
> first_name varchar(15) NOT NULL,
> service_type char NOT NULL,
> sex char NOT NULL,
> detailed_bill char NOT NULL,
> ngetest_status char NOT NULL,
> disc_all char,
> disc_country char,
> disc_pin char,
>
> constraint pk_ngetest PRIMARY KEY (custnum),
>
> constraint ck_ngetest_service_type check
> (service_type = 'Y' or
> service_type = 'N' or
> service_type = 'G' or
> service_type = 'M' or
> service_type = 'O' or
> service_type = 'D'),
>
> constraint ck_ngetest_status check
> (ngetest_status = 'A' or
> ngetest_status = 'I' or
> ngetest_status = 'S' or
> ngetest_status = 'T'),
>
> constraint ck_ngetest_disc_all check
> (disc_all = 'Y' or
> disc_all = 'N'),
> constraint ck_ngetest_disc_country check
> (disc_country = 'Y' or
> disc_country = 'N'),
> constraint ck_ngetest_disc_pin check
> (disc_pin = 'Y' or
> disc_pin = 'N')
> );
>
> insert into ngetest
> (custnum, first_name, service_type, sex, detailed_bill, ngetest_status,
> disc_all)
> values
> (1,'Bob','Y','M','Y','A','Y');
> ERROR: ExecAppend: rejected due to CHECK constraint ck_ngetest_disc_pin
disc_pin is null in this statement and constraint ck_ngetest_disc_pin says
that it can' t be null
Bye
Claudio
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: [SQL] Constraint Problem
@ 1999-09-30 10:46 Gerhard Dieringer <DieringG@eba-haus.de>
0 siblings, 0 replies; 13+ messages in thread
From: Gerhard Dieringer @ 1999-09-30 10:46 UTC (permalink / raw)
To: " <"<pgsql-sql@postgresql.org>
Chairudin Sentosa wrote:
> ...
> constraint ck_ngetest_disc_pin check
> (disc_pin = 'Y' or
> disc_pin = 'N')
> ...
> ...
> insert into ngetest
>(custnum, first_name, service_type, sex, detailed_bill, ngetest_status,disc_all)
>values (1,'Bob','Y','M','Y','A','Y');
>ERROR: ExecAppend: rejected due to CHECK constraint ck_ngetest_disc_pin
>...
I am not sure, but I think the problem is, that you have no value for disc_pin in your insert, so it is NULL
but in your constraint ck_ngetest_disc_pin you only allow 'Y' or 'N' for this attribute.
The same problem ocures for the other inserts.
I hope this will help you.
Gerhard
^ permalink raw reply [nested|flat] 13+ messages in thread
* Constraint problem
@ 2002-05-16 18:48 Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:12 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
0 siblings, 2 replies; 13+ messages in thread
From: Josh Berkus @ 2002-05-16 18:48 UTC (permalink / raw)
To: pgsql-sql
Folks,
I don't seem to be able to create a UNIQUE constraint as DEFERRABLE. Is this
not supported?
--
-Josh Berkus
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
@ 2002-05-16 19:11 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
1 sibling, 1 reply; 13+ messages in thread
From: Stephan Szabo @ 2002-05-16 19:11 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql
On Thu, 16 May 2002, Josh Berkus wrote:
> Folks,
>
> I don't seem to be able to create a UNIQUE constraint as DEFERRABLE. Is this
> not supported?
Not currently.
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
@ 2002-05-16 19:30 ` Josh Berkus <josh@agliodbs.com>
2002-05-16 20:39 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-17 02:22 ` Re: Constraint problem Christopher Kings-Lynne <chriskl@familyhealth.com.au>
0 siblings, 2 replies; 13+ messages in thread
From: Josh Berkus @ 2002-05-16 19:30 UTC (permalink / raw)
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: pgsql-sql
Stephan,
> > I don't seem to be able to create a UNIQUE constraint as DEFERRABLE. Is
this
> > not supported?
>
> Not currently.
Hmm ... my workaround didn't work. I need to impose a unique constraint on
an INT column in a table, but make sure that the constraint isn't checked
until the end of an UPDATE statement, so that I can swap values when I need
to.
How can I do this?
--
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
@ 2002-05-16 20:39 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 20:49 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
1 sibling, 1 reply; 13+ messages in thread
From: Stephan Szabo @ 2002-05-16 20:39 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql
On Thu, 16 May 2002, Josh Berkus wrote:
>
> Stephan,
> > > I don't seem to be able to create a UNIQUE constraint as DEFERRABLE. Is
> this
> > > not supported?
> >
> > Not currently.
>
> Hmm ... my workaround didn't work. I need to impose a unique constraint on
> an INT column in a table, but make sure that the constraint isn't checked
> until the end of an UPDATE statement, so that I can swap values when I need
> to.
>
> How can I do this?
I unfortunately can't think of a good workaround. AFAICT, Unique should
wait until after all of the updates but our implementation doesn't
currently do so.
Hopefully someone will have some ideas, because the best I can think of
requires an additional full table scan to check uniqueness and the
concurrency issues would be a bear.
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 20:39 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
@ 2002-05-16 20:49 ` Josh Berkus <josh@agliodbs.com>
2002-05-17 01:12 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 1 reply; 13+ messages in thread
From: Josh Berkus @ 2002-05-16 20:49 UTC (permalink / raw)
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: pgsql-sql
Stephan,
> I unfortunately can't think of a good workaround. AFAICT, Unique should
> wait until after all of the updates but our implementation doesn't
> currently do so.
>
> Hopefully someone will have some ideas, because the best I can think of
> requires an additional full table scan to check uniqueness and the
> concurrency issues would be a bear.
Hmm ... I can put up with that, I think. This table doesn't get modified very
often, and I can afford to table-level lock it during modification.
However, I can't think of how I could implement a BEFORE ... FOR EACH
STATEMENT trigger that would check for duplicates in the final result. I can
only deal with one row at a time using the NEW record.
Suggestions?
--
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 20:39 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 20:49 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
@ 2002-05-17 01:12 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-17 04:40 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
0 siblings, 1 reply; 13+ messages in thread
From: Stephan Szabo @ 2002-05-17 01:12 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql
On Thu, 16 May 2002, Josh Berkus wrote:
>
> Stephan,
>
> > I unfortunately can't think of a good workaround. AFAICT, Unique should
> > wait until after all of the updates but our implementation doesn't
> > currently do so.
> >
> > Hopefully someone will have some ideas, because the best I can think of
> > requires an additional full table scan to check uniqueness and the
> > concurrency issues would be a bear.
>
> Hmm ... I can put up with that, I think. This table doesn't get modified very
> often, and I can afford to table-level lock it during modification.
>
> However, I can't think of how I could implement a BEFORE ... FOR EACH
> STATEMENT trigger that would check for duplicates in the final result. I can
> only deal with one row at a time using the NEW record.
>
> Suggestions?
AFAIK we don't actually have statement triggers right now, anyway, but...
Actually, I guess an after trigger that just checked the new values would
work as well, right? See if there exists more than one row with the new
key value. The after trigger should fire after all the changes are done
and in the worst case you could use constraint triggers and deferment.
The hard part about this really is making it work with concurrent
modifications, and if you're willing to forgo that, it shouldn't be too
bad.
This would degenerate in the case you're modifying a large percentage of
the table, since you'd be doing one indexscan per row modified and in
general you know that you'll need to do all of them (ie there was no
violation).
As a starting point, I did something like this:
create table az(a int);
create or replace function az_uni() returns opaque as '
DECLARE
r int;
BEGIN
SELECT INTO r count(*) FROM az where a=NEW.a;
if (r>1) then
RAISE EXCEPTION ''Uniqueness on az(a) violated.'';
END IF;
return NEW;
END;
' language 'plpgsql';
create trigger az_unit after insert or update on az for each row execute
procedure az_uni();
This still relies on the user doing a lock to get around the fact that it
won't handle concurrent changes, but in really simple tests (insert the
same value twice, do something like key=key+1 where key has sequential
values) in one session it worked.
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 20:39 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 20:49 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-17 01:12 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
@ 2002-05-17 04:40 ` Josh Berkus <josh@agliodbs.com>
2002-05-17 18:42 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 1 reply; 13+ messages in thread
From: Josh Berkus @ 2002-05-17 04:40 UTC (permalink / raw)
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>; Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql
Stephan,
> AFAIK we don't actually have statement triggers right now, anyway,
> but...
> Actually, I guess an after trigger that just checked the new values
> would
> work as well, right? See if there exists more than one row with the
> new
> key value. The after trigger should fire after all the changes are
> done
> and in the worst case you could use constraint triggers and
> deferment.
> The hard part about this really is making it work with concurrent
> modifications, and if you're willing to forgo that, it shouldn't be
> too
> bad.
Thanks. I'll give your solution a try and see what the performance hit
is.
Is the Unique Constraint issue on the To-Do list?
Chris: The "holding value" solution won't work for me. I'm usually
changing dozens of values at a time, and they need to stay in the same
sequence while blocks of them move on the scale.
FYI, I'm implementing Joe Celko's "Linear Nested Set Model" of tree
structures.
-Josh Berkus
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 20:39 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 20:49 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-17 01:12 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-17 04:40 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
@ 2002-05-17 18:42 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
0 siblings, 0 replies; 13+ messages in thread
From: Stephan Szabo @ 2002-05-17 18:42 UTC (permalink / raw)
To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql
On Thu, 16 May 2002, Josh Berkus wrote:
> Stephan,
>
> > AFAIK we don't actually have statement triggers right now, anyway,
> > but...
> > Actually, I guess an after trigger that just checked the new values
> > would
> > work as well, right? See if there exists more than one row with the
> > new
> > key value. The after trigger should fire after all the changes are
> > done
> > and in the worst case you could use constraint triggers and
> > deferment.
> > The hard part about this really is making it work with concurrent
> > modifications, and if you're willing to forgo that, it shouldn't be
> > too
> > bad.
>
> Thanks. I'll give your solution a try and see what the performance hit
> is.
>
> Is the Unique Constraint issue on the To-Do list?
I'm not sure. I know it's been mentioned in the past, so probably (too
lazy to look right now).
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
@ 2002-05-17 02:22 ` Christopher Kings-Lynne <chriskl@familyhealth.com.au>
1 sibling, 0 replies; 13+ messages in thread
From: Christopher Kings-Lynne @ 2002-05-17 02:22 UTC (permalink / raw)
To: josh@agliodbs.com; Stephan Szabo <sszabo@megazone23.bigpanda.com>; +Cc: pgsql-sql
What about using an intermediary value such as -1;
update foo set a = -1;
update foo set b = old a value;
update foo set a = old b value;
Sort of thing?
Chris
> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org
> [mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Josh Berkus
> Sent: Friday, 17 May 2002 3:30 AM
> To: Stephan Szabo
> Cc: pgsql-sql@postgresql.org
> Subject: Re: [SQL] Constraint problem
>
>
>
> Stephan,
> > > I don't seem to be able to create a UNIQUE constraint as
> DEFERRABLE. Is
> this
> > > not supported?
> >
> > Not currently.
>
> Hmm ... my workaround didn't work. I need to impose a unique
> constraint on
> an INT column in a table, but make sure that the constraint isn't checked
> until the end of an UPDATE statement, so that I can swap values
> when I need
> to.
>
> How can I do this?
>
> --
> -Josh Berkus
>
> ______AGLIO DATABASE SOLUTIONS___________________________
> Josh Berkus
> Complete information technology josh@agliodbs.com
> and data management solutions (415) 565-7293
> for law firms, small businesses fax 621-2533
> and non-profit organizations. San Francisco
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
^ permalink raw reply [nested|flat] 13+ messages in thread
* Re: Constraint problem
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
@ 2002-05-16 19:12 ` Josh Berkus <josh@agliodbs.com>
1 sibling, 0 replies; 13+ messages in thread
From: Josh Berkus @ 2002-05-16 19:12 UTC (permalink / raw)
To: pgsql-sql
Folks,
> I don't seem to be able to create a UNIQUE constraint as DEFERRABLE. Is
this
> not supported?
Never mind. I found my way around this.
--
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
^ permalink raw reply [nested|flat] 13+ messages in thread
end of thread, other threads:[~2002-05-17 18:42 UTC | newest]
Thread overview: 13+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-09-30 08:05 Constraint Problem Chairudin Sentosa Harjo <chai@prima.net.id>
1999-10-08 07:28 ` Claudio Tassi <claudio@janet.NOSPAM.it>
1999-09-30 10:46 Re: [SQL] Constraint Problem Gerhard Dieringer <DieringG@eba-haus.de>
2002-05-16 18:48 Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 19:11 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 19:30 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-16 20:39 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-16 20:49 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-17 01:12 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-17 04:40 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
2002-05-17 18:42 ` Re: Constraint problem Stephan Szabo <sszabo@megazone23.bigpanda.com>
2002-05-17 02:22 ` Re: Constraint problem Christopher Kings-Lynne <chriskl@familyhealth.com.au>
2002-05-16 19:12 ` Re: Constraint problem Josh Berkus <josh@agliodbs.com>
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