|
From: Afonso B. <aag...@gm...> - 2013-06-12 10:46:40
|
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
|
|
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>
|
|
From: Afonso B. <aag...@gm...> - 2013-06-13 10:37:32
|
Hi, Abbas,
First I'd the thank you for your prompt answer,
1 - I tried to install direct from moodle.org (moodle25+)
the first column id is missing because its use a sequence to get the
next value.
I installed the same version (moodle25+) with postgres91 and
everything goes well.
2 - when I tried to install in the same way, in postgres-xc I get the
error message tha t i send to you
I will try your suggestions
and try it again,
When I finished I will share our experience
Best Regards
Afonso Bione
On Thu, Jun 13, 2013 at 3:54 AM, Abbas Butt <abb...@en...>wrote:
>
> 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>
>
|
|
From: Afonso B. <aag...@gm...> - 2013-06-13 11:39:57
|
Hi,
I miss to send this!
psql (PGXC 1.0.3, based on PG 9.1.9)
Type "help" for help.
moodle=# INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
50,'1',0,1);
INSERT 0 1
moodle=# INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
50,'1',0,1);
INSERT 0 1
moodle=# INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
50,'1',0,1);
INSERT 0 1
moodle=# select * from mdl_context;
id | contextlevel | instanceid | path | depth
----+--------------+------------+------+-------
1 | 50 | 1 | 0 | 1
1 | 50 | 1 | 0 | 1
1 | 50 | 1 | 0 | 1
thanks
On Thu, Jun 13, 2013 at 7:37 AM, Afonso Bione <aag...@gm...> wrote:
> Hi, Abbas,
>
> First I'd the thank you for your prompt answer,
> 1 - I tried to install direct from moodle.org (moodle25+)
> the first column id is missing because its use a sequence to get
> the next value.
> I installed the same version (moodle25+) with postgres91 and
> everything goes well.
>
> 2 - when I tried to install in the same way, in postgres-xc I get the
> error message tha t i send to you
> I will try your suggestions
> and try it again,
>
> When I finished I will share our experience
> Best Regards
> Afonso Bione
>
>
> On Thu, Jun 13, 2013 at 3:54 AM, Abbas Butt <abb...@en...>wrote:
>
>>
>> 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>
>>
>
>
|
|
From: Abbas B. <abb...@en...> - 2013-06-13 14:31:08
|
I see that you got the same value for three successive calls to nextval,
and the PK constraint also did not complain while inserting. I do not
remember if that was a known bug in 1.0, but can you please try it on a
later version of XC, 1.1 if not master.
On Thu, Jun 13, 2013 at 4:39 PM, Afonso Bione <aag...@gm...> wrote:
> Hi,
>
> I miss to send this!
>
> psql (PGXC 1.0.3, based on PG 9.1.9)
> Type "help" for help.
>
> moodle=# INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
> 50,'1',0,1);
> INSERT 0 1
> moodle=# INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
> 50,'1',0,1);
> INSERT 0 1
> moodle=# INSERT INTO mdl_context VALUES(nextval('mdl_context_id_seq'),
> 50,'1',0,1);
> INSERT 0 1
> moodle=# select * from mdl_context;
>
> id | contextlevel | instanceid | path | depth
> ----+--------------+------------+------+-------
> 1 | 50 | 1 | 0 | 1
> 1 | 50 | 1 | 0 | 1
> 1 | 50 | 1 | 0 | 1
>
> thanks
>
>
>
> On Thu, Jun 13, 2013 at 7:37 AM, Afonso Bione <aag...@gm...> wrote:
>
>> Hi, Abbas,
>>
>> First I'd the thank you for your prompt answer,
>> 1 - I tried to install direct from moodle.org (moodle25+)
>> the first column id is missing because its use a sequence to get
>> the next value.
>> I installed the same version (moodle25+) with postgres91 and
>> everything goes well.
>>
>> 2 - when I tried to install in the same way, in postgres-xc I get the
>> error message tha t i send to you
>> I will try your suggestions
>> and try it again,
>>
>> When I finished I will share our experience
>> Best Regards
>> Afonso Bione
>>
>>
>> On Thu, Jun 13, 2013 at 3:54 AM, Abbas Butt <abb...@en...>wrote:
>>
>>>
>>> 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>
>>>
>>
>>
>
--
--
*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>
|