|
From: Abbas B. <abb...@en...> - 2013-06-13 06:54:30
|
Hi,
There are a few things you need to look at.
1. The definition of the table mdl_context has 5 columns, whereas the
INSERT is only mentioning 4. The first column i.e. id is missed and was not
given any default value either. For me even the first attempt to run the
insert fails, let alone the duplicate key error, which would be expected on
second attempt.
2. I am supposing that you were able to create moodle database in XC and
when you ran moodle GUI and tried to create something it failed, Is this
true? If yes what configuration of cluster are you using? If not from where
is this insert coming from?
3. I tried a modified test case similar to what you mentioned on current
master and found it works fine.
CREATE TABLE mdl_context (id bigint NOT NULL,contextlevel bigint DEFAULT 0
NOT NULL,instanceid bigint DEFAULT 0 NOT NULL,path character
varying(255),depth smallint DEFAULT 0 NOT NULL);
ALTER TABLE public.mdl_context OWNER TO edb;
ALTER TABLE ONLY mdl_context ADD CONSTRAINT mdl_cont_id_pk PRIMARY KEY (id);
CREATE SEQUENCE mdl_context_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE
NO MAXVALUE CACHE 1;
ALTER TABLE public.mdl_context_id_seq OWNER TO edb;
ALTER SEQUENCE mdl_context_id_seq OWNED BY mdl_context.id;
INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
50,'1',0,NULL);
INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
50,'1',0,NULL);
INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
50,'1',0,NULL);
INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
50,'1',0,NULL);
select * from mdl_context;
id | contextlevel | instanceid | path | depth
----+--------------+------------+------+-------
3 | 50 | 1 | | 0
4 | 50 | 1 | | 0
1 | 50 | 1 | | 0
2 | 50 | 1 | | 0
(4 rows)
If you happen to run moodle successfully , please do share your experiences.
Regards
On Wed, Jun 12, 2013 at 3:46 PM, Afonso Bione <aag...@gm...> wrote:
> Please, i'm very new in postgres-xc and I need help with
> instlal moodle 2.5 with postgres-xc
>
> here is the error message
>
> Debug info: ERROR: duplicate key value violates unique constraint
> "mdl_cont_id_pk"
> DETAIL: Key (id)=(1) already exists.
> INSERT INTO mdl_context (contextlevel,instanceid,depth,path)
> VALUES($1,$2,$3,$4) RETURNING id
> [array (
> 'contextlevel' => 50,
> 'instanceid' => '1',
> 'depth' => 0,
> 'path' => NULL,
> )]
>
> ---------------------------------------------
> and this are the tables that the system shows
>
>
> --
> -- Name: mdl_context; Type: TABLE; Schema: public; Owner: postgres;
> Tablespace:
> --
>
> CREATE TABLE mdl_context (
> id bigint NOT NULL,
> contextlevel bigint DEFAULT 0 NOT NULL,
> instanceid bigint DEFAULT 0 NOT NULL,
> path character varying(255),
> depth smallint DEFAULT 0 NOT NULL
> );
>
>
> ALTER TABLE public.mdl_context OWNER TO postgres;
>
> --
> -- Name: mdl_cont_id_pk; Type: CONSTRAINT; Schema: public; Owner:
> postgres; Tablespace:
> --
>
> ALTER TABLE ONLY mdl_context
> ADD CONSTRAINT mdl_cont_id_pk PRIMARY KEY (id);
>
>
>
> --
> -- Name: TABLE mdl_context; Type: COMMENT; Schema: public; Owner: postgres
> --
>
> COMMENT ON TABLE mdl_context IS 'one of these must be set';
> -
> -- Name: mdl_context_id_seq; Type: SEQUENCE; Schema: public; Owner:
> postgres
> --
>
> CREATE SEQUENCE mdl_context_id_seq
> START WITH 1
> INCREMENT BY 1
> NO MINVALUE
> NO MAXVALUE
> CACHE 1;
>
>
> ALTER TABLE public.mdl_context_id_seq OWNER TO postgres;
>
> --
> -- Name: mdl_context_id_seq; Type: SEQUENCE OWNED BY; Schema: public;
> Owner: postgres
> --
>
> ALTER SEQUENCE mdl_context_id_seq OWNED BY mdl_context.id;
>
>
> --
> -- Name: mdl_context_temp; Type: TABLE; Schema: public; Owner: postgres;
> Tablespace:
> --
>
> CREATE TABLE mdl_context_temp (
> id bigint NOT NULL,
> path character varying(255) DEFAULT ''::character varying NOT NULL,
> depth smallint NOT NULL
> );
>
>
> ALTER TABLE public.mdl_context_temp OWNER TO postgres;
>
> --
> -- Name: TABLE mdl_context_temp; Type: COMMENT; Schema: public; Owner:
> postgres
> --
> COMMENT ON TABLE mdl_context_temp IS 'Used by build_context_path() in
> upgrade and cron to keep context depths and paths in sync.';
>
>
> Best Regards
> Afonso Bione
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Postgres-xc-general mailing list
> Pos...@li...
> https://lists.sourceforge.net/lists/listinfo/postgres-xc-general
>
>
--
--
*Abbas*
Architect
Ph: 92.334.5100153
Skype ID: gabbasb
www.enterprisedb.co
<http://www.enterprisedb.com/>m<http://www.enterprisedb.com/>
*
Follow us on Twitter*
@EnterpriseDB
Visit EnterpriseDB for tutorials, webinars,
whitepapers<http://www.enterprisedb.com/resources-community>and
more<http://www.enterprisedb.com/resources-community>
|